Re: [RFC] Using objects as keys
| From: | Lester Caine | Date: | Thu, 30 Oct 2014 23:20:51 +0000 |
| Subject: | Re: [RFC] Using objects as keys | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78497@lists.php.net to get a copy of this message | ||
On 30/10/14 17:42, Rowan Collins wrote:
> The use case which came up recently was UString objects, which can
> easily be converted to and from plain PHP strings, but would be useful
> as keys in their own right. With current PHP you could do $foo[
> (string)$u_str ] = $bar; with the proposed RFC, you could do $foo[
> $u_str ] = $bar with the same result; but either way, you would still
> need to convert *back* to an object in order to use any of the UString
> methods in a foreach(), array_walk(), etc.
I would still like to see the debate on proper use of unicode IN PHP
strings. Pushing that problem into objects is just as wrong as this
debate. If I'm using a unicode colation to sort a set of array keys then
the KEY should be unicode, not yet another handle to a secondary object
which the needs to be sorted ... but then perhaps we need this fiddle to
avoid the complexity that unicode can create?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk