note 15155 added to language.types.string
| From: | hopson at orst dot NOSPAM dot edu | Date: | Wed, 29 Aug 2001 18:57:20 +0000 |
| Subject: | note 15155 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17362@lists.php.net to get a copy of this message | ||
Converts from C and its descendents may attempt to do type casting on a character:
$myChar = 'A';
$myCharAscii = (integer)$myChar;
This doesn't work, because PHP can only cast the numerical digits in a string to an int.
Instead, use the functions
string chr (int ascii)
int ord (string string)
to convert to and from single characters.
http://www.php.net/manual/en/language.types.string.php