+ 1
Did anyone know how increment alphabet works?(PHP)
If I use increment alphabet, for example a++ i get the result b. I don't understand how it works. How can PHP increment a string? Is it a temp array?
3 ответов
+ 2
every char have ascii code . for (a) its 97
so when u ++ its going to be 98 (b) and so on ...
visit www.asciitable.com for more info
+ 2
$x = 'A';
$x++;
echo $x;
$y = 'AB';
$y++;
echo $y;
$z = 'ABC';
$z++;
echo $z;
note : no DEcrement.
or just in case you need specific increment ,
convert per Char to Ascii , substract / add , then put back to Char..
+ 1
It is not ASCII because: z++ =aa. If its Ascii the result of z++ should be { .