PHP:Convert a String to Chars

From Progzoo
Revision as of 08:51, 15 January 2010 by Spoon! (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PHP does not have the char type, just numbers and string.

You can convert to and from ASCII values and Strings using ord and chr

You can treat a string as an array of characters

Show character number 2 (the third character) and the ASCII value of this.

[Font] [Default] [Show] [Resize] [History] [Profile]

See for details of how to deal with multi-byte strings such as utf-8