hi people
little question,
$a="a";
$a++; will result in $a=b
now I want to do the opposite
$a--; but it gives the same letter
what am I doing wrong?
cheers
Kgtrip
| SitePoint Sponsor |




hi people
little question,
$a="a";
$a++; will result in $a=b
now I want to do the opposite
$a--; but it gives the same letter
what am I doing wrong?
cheers
Kgtrip





you can only do ++ and -- do integers, not strings.
were you looking for chr ?




still how can I move forward and backward in the char values???


Originally Posted by kgtrip
Bear in mind you'll probably want to error-check to catch the ends of the alphabet. Gaheris listed the ascii numbers that the ord function will return for the various characters.PHP Code:$char = 'a';
// to add one, use:
$char = chr(ord($char)+1);
// to subtract one, use:
$char = chr(ord($char)-1);




OK
that seems ok I'll check it out
Thank's guys![]()
Bookmarks