Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37149 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21530 invoked from network); 20 Apr 2008 13:21:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2008 13:21:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=wietse@porcupine.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=wietse@porcupine.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain porcupine.org from 168.100.189.2 cause and error) X-PHP-List-Original-Sender: wietse@porcupine.org X-Host-Fingerprint: 168.100.189.2 spike.porcupine.org FreeBSD 2.0-4.2 Received: from [168.100.189.2] ([168.100.189.2:2652] helo=spike.porcupine.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 30/86-19592-9634B084 for ; Sun, 20 Apr 2008 09:21:46 -0400 Received: by spike.porcupine.org (Postfix, from userid 1001) id 43A9D1F3E9F; Sun, 20 Apr 2008 09:21:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=porcupine.org; s=dktest; t=1208697703; bh=AyMx9k1Z3FA5ZyJFTBhGV2OIuMVUyVFOI0QuAfce 4yI=; h=Subject:In-Reply-To:To:Date:X-Time-Zone:X-Mailer: MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id: From; b=HtHcGyv+hm4om6FxucWIIADdH9DJZuZ0iKWEgt6rvezbyg2tOUEk5rsAgz /S6Im2pNncpI98DQXcE93Xpkg0DSjkdGmfe67xHTRYBovSA3/m+B+qi4c9PIM+tJ+wk Kx1Wv1+88AlbqqspKzaJFJ5apQ2m0iTkePFU6Mq28BlnJ8= In-Reply-To: <20080418104018.epguxp7v4844oowk@zesix.com> "from Kalle Sommer Nielsen at Apr 18, 2008 10:40:18 am" To: internals@lists.php.net Date: Sun, 20 Apr 2008 09:21:43 -0400 (EDT) X-Time-Zone: USA EST, 6 hours behind central European time X-Mailer: ELM [version 2.4ME+ PL82 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-ID: <20080420132143.43A9D1F3E9F@spike.porcupine.org> Subject: Re: [PHP-DEV] Array access on function returns From: wietse@porcupine.org ((Wietse Venema)) References: <20080418104018.epguxp7v4844oowk@zesix.com> Kalle Sommer Nielsen: > Hey Internals > > I've been wondering for quite some time why PHP doesn't allow you > to access arrays when you assign it to a value like in Javascript: In many languages you get such functionality for free, because their parsers are written to accept: expression '[' expression ']' Thus, any expression that evaluates to an array can have '[]'. Javascript, Perl and C are just a few examples. The PHP parser is different. It requires a variable to the left of '['. Changing this is not as simple as changing one or two YACC rules. Wietse