Re: deprecation status of $str{42} versus $str[42]

From: Date: Thu, 19 Jun 2008 00:57:10 +0000
Subject: Re: deprecation status of $str{42} versus $str[42]
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-38373@lists.php.net to get a copy of this message
Yes, and we can have TextIterator work on binary strings as well (perhaps by adding TextIterator::BYTE constant). -Andrei Edward Z. Yang wrote:
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.


« previous php.internals (#38373) next »