Re: [RFC] Convert numeric keys in object/array casts

From: Date: Sun, 23 Oct 2016 15:23:17 +0000
Subject: Re: [RFC] Convert numeric keys in object/array casts
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-96560@lists.php.net to get a copy of this message
Hi Yasuo, Yasuo Ohgaki wrote:
Nice RFC! It seems patch is made to convert int index to string index to allow numeric key, is it?
Or vice-versa, yes.
I guess it is the limitation and the reason why it's inaccessible.
Yes. If you have an object whose HashTable has an integer key, say 123, and you try to look up the object property 123, it will look for the string key "123", and will not find it.
Numeric key name must be string? $obj->{'0'} = 1; or could be like (Without quotes) $obj->{0} = 1;
Both are supported, either way it converts to a string key. -- Andrea Faulds https://ajf.me/

« previous php.internals (#96560) next »