Re: [RFC] Fix list() behavior inconsistency

From: Date: Sun, 14 Sep 2014 17:26:24 +0000
Subject: Re: [RFC] Fix list() behavior inconsistency
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-77190@lists.php.net to get a copy of this message
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]

« previous php.internals (#77190) next »