Re: [PHP-I18N] Can I use strings with some unicode characters as array keys?
[email protected] (Darren Cook) Sun, 31 Jul 2011 12:16:16 +0900
| Newsgroups | php.i18n |
|---|---|
| Message-ID | <[email protected]> |
> PHP manual says that one should only use strings or integers as keys. > Also I know that PHP doesn't speak unicode yet. Depending on what you mean by speaking unicode; the mbstring extension has worked well for everything I've ever needed to do with unicode, and supports all the various unicode character sets. > So - I was just wondering - when unicode characteres aare used in > array key - does PHP strips them or affects them in any way? I believe that string array keys are treated as binary strings, and never modified. I couldn't find you a source, but I've always worked on this assumption and never hit a problem. UTF-8 keys definitely work fine (*); I'm also not aware of any max length the keys can have (meaning you shouldn't have to worry about a multi-byte character getting truncated in the middle). Darren *: Well, to fully qualify that, I may only ever have tried with Japanese, Chinese, Arabic and European languages :-) -- Darren Cook, Software Researcher/Developer http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles)