Increment alphabet characters (PHP)

26/09/2010 | 13:02 | Code

This week I discovered something new in PHP. It’s possible to increment alphabet characters with PHP. How cool is that!

$char = "a";
$char++;
echo($char);

This will result in the letter “b”. The same applies to uppercase characters (like capitals).

What happens if you reach the last letter in the alphabet:

$char = "z";
$char++;
echo($char);

This will result in “aa”.