Re: Increment alphabetical character (simple question)
| From: | David Robley | Date: | Wed, 13 Feb 2002 00:26:47 +0000 |
| Subject: | Re: Increment alphabetical character (simple question) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84515@lists.php.net to get a copy of this message | ||
In article <3C699E06.6820BD32@phantomcougar.com>,
phantom@phantomcougar.com says...
> How do I get the ASCII value of a character.... increment it by one...
> and convert back to a character.
>
> For example:
>
> I want to grab a char such as "C" and increment it to "D" ???
ord() and chr() will do this.
$oldchar = "C";
$newchar = chr(ord($oldchar) + 1);
should be close to the mark. NB untested!!
--
David Robley
Temporary Kiwi!