Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96560 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67157 invoked from network); 23 Oct 2016 15:23:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2016 15:23:23 -0000 X-Host-Fingerprint: 2.124.144.170 unknown Received: from [2.124.144.170] ([2.124.144.170:11252] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/10-28528-9E5DC085 for ; Sun, 23 Oct 2016 11:23:23 -0400 Message-ID: <57.10.28528.9E5DC085@pb1.pair.com> To: internals@lists.php.net References: <59.D6.28528.0B0AA085@pb1.pair.com> Date: Sun, 23 Oct 2016 16:23:17 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 2.124.144.170 Subject: Re: [PHP-DEV] [RFC] Convert numeric keys in object/array casts From: ajf@ajf.me (Andrea Faulds) 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/