Re: Re: foreach() for strings
| From: | Johannes Schlüter | Date: | Mon, 20 Jun 2011 21:27:04 +0000 |
| Subject: | Re: Re: foreach() for strings | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-53451@lists.php.net to get a copy of this message | ||
On Mon, 2011-06-20 at 20:38 +0200, Robert Eisele wrote:
> I really like the ideas shared here. It's a thing of consideration that
> array-functions should also work with strings. Maybe this would be the way
> to go, but I'm more excited about the OOP implementation of TextIterator and
> ByteIterator, which solves the whole problem at once (and is easier to
> implement, as mentioned by Stas). As Jonathan said, Database results with a
> certain encoding could get iterated, too. The only way to workaround the
> Text/Byte problem would be, offsetting >EVERY< string with 1-2 byte
> "string-type" information or an additional type flag in the zval-strcuture.
> Handling everything with zval's instead of objects would have the advantage,
> that database-layers like mysqlnd could write the database-encoding directly
> into the zval and the user had no need to decide what encoding is used.
Welcome back to the failed PHP 6 Unicode project. ;-)
(while we didn't store the original encoding but converted to Utf-16,
which prevents random/strange conversions in other places when mixing
encodings)
johannes