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.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to