Re: deprecation status of $str{42} versus $str[42]
| From: | Edward Z. Yang | Date: | Thu, 19 Jun 2008 00:27:48 +0000 |
| Subject: | Re: deprecation status of $str{42} versus $str[42] | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38371@lists.php.net to get a copy of this message | ||
Andrei Zmievski wrote:
> Maybe TextIterator can be backported from HEAD, because it allows for
> just that.
>
> foreach (new TextIterator($str) as $c) {
> ...
> }
IIRC, TextIterator is specifically designed for Unicode, letting you
iterate over codepoints, combining sequences, characters, words, etc. So
making it do all that would only make sense with intl, and even then not
really (as Stanislav points out performance-wise).
What I was suggesting was a shortcut to iterating over binary data; i.e.
byte by byte.
--
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <http://htmlpurifier.org> Anti-XSS Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]