Saturday, December 21, 2013

PHP Incrementing characters

PHP provides an easy way to increment characters.

$var='a';

$var++;
echo $var;    // outputs b

If we increment a character by five positions,then increment has to be done five times.
$var++;
$var++;
$var++;
$var++;
$var++;

$var=$var+5;   // this does not increments the character by five positions

2 comments: