Re: [PHP-DEV] [RFC] Fix list() behavior inconsistency

[email protected] (Rowan Collins)
Newsgroups php.internals
Message-ID <[email protected]>
On 14/09/2014 08:54, Lester Caine wrote:
> One has to assume first that what is returned is a simple byte
> string array while currently is IS possible that it will contain unicode
> characters?

Well, currently, every single string function in PHP treats a string as 
a simple byte array, apart from those in the mbstring and intl extensions.

What's more, there isn't really a single meaning of the term "Unicode 
character" - at its simplest, there are code points, but they're not 
necessarily the most useful unit; as I mentioned before [1], people 
often actually want to work with "grapheme clusters", what a writer of 
the language would consider "a single character".

If more integrated Unicode support is ever added, it will presumably be 
in the form of a new data type; if that type implements $foo[0] to mean 
"first grapheme cluster", then it would be natural for list($a,) = $foo 
to do the same. But there is no reason for that to stop list($a,) = $foo 
being equivalent to $foo[0] for existing strings, and mean "first byte".

[1] http://news.php.net/php.internals/72914

-- 
Rowan Collins
[IMSoP]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.