Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56907 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38251 invoked from network); 13 Dec 2011 13:15:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2011 13:15:58 -0000 Authentication-Results: pb1.pair.com header.from=chortos@inbox.lv; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chortos@inbox.lv; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain inbox.lv designates 89.111.3.84 as permitted sender) X-PHP-List-Original-Sender: chortos@inbox.lv X-Host-Fingerprint: 89.111.3.84 shark4.inbox.lv Received: from [89.111.3.84] ([89.111.3.84:46061] helo=shark4.inbox.lv) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/20-36518-A0057EE4 for ; Tue, 13 Dec 2011 08:15:56 -0500 Received: from mail.inbox.lv (pop [10.0.1.110]) by shark4-plain.inbox.lv (Postfix) with ESMTP id 0EA4022F61; Tue, 13 Dec 2011 15:15:51 +0200 (EET) Received: from [192.168.1.139] (unknown [77.38.233.95]) (Authenticated sender: chortos@inbox.lv) by mail.inbox.lv (Postfix) with ESMTPSA id A20541CF65; Tue, 13 Dec 2011 15:15:50 +0200 (EET) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Tue, 13 Dec 2011 15:15:49 +0200 Cc: PHP Internals Content-Transfer-Encoding: 7bit Message-ID: References: To: Laruence , Morfi X-Mailer: Apple Mail (2.1084) X-Virus-Scanned: OK Subject: Re: [PHP-DEV] [RFC]Call for voting about const array/string dereference From: chortos@inbox.lv (Oleg Oshmyan) > Call for voting about the const array/string derefernce RFC now. > > you can find more info here: > https://wiki.php.net/rfc/constdereference#vote I have always wondered why array dereference does not just work on arbitrary expressions in PHP like other operators do. Even with the latest modification that allows dereferencing function calls, this works: md5('')[0] but this results in a parse error (syntax error, unexpected '['): (md5(''))[0] Then there are expressions like ('a'.'b')[0], all sorts of combinations of operators... Why not just treat any 'expression[expression]' as an array dereference as other languages do? >> echo "foobar"["foo"][0]; > > "foobar"["foo"] - Why not "undefined index"? "foo" is converted to an integer, yielding zero. 'Undefined index' seems to make more sense to me but PHP 5.3 behaves the same way. -- Oleg