Thursday, January 13, 2011

How to loop A-Z in php

Just like counting numbers :)

$letter = "A";
for($i = 1; $i<= 26; $i++)
{
  $letter++;
  echo $letter;
}

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Startvalue of $i should be 0 and not inclluding 26, so to make it right it is like that:

    for($i = 0; $i<26; $i++)

    ReplyDelete