Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37138 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75857 invoked from network); 18 Apr 2008 18:29:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2008 18:29:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 208.70.128.103 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 208.70.128.103 smtp-gw77.mailanyone.net Received: from [208.70.128.103] ([208.70.128.103:37306] helo=smtp-gw77.mailanyone.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/1D-10014-B68E8084 for ; Fri, 18 Apr 2008 14:28:59 -0400 Received: from mailanyone.net by smtp-gw77.mailanyone.net with esmtpsa (TLSv1:RC4-MD5:128) (MailAnyone extSMTP sam@sambarrow.com) id 1JmvKR-0000uv-T2; Fri, 18 Apr 2008 13:28:56 -0500 To: Kalle Sommer Nielsen Cc: internals@lists.php.net In-Reply-To: <20080418104018.epguxp7v4844oowk@zesix.com> References: <20080418104018.epguxp7v4844oowk@zesix.com> Content-Type: text/plain Date: Fri, 18 Apr 2008 14:26:25 -0400 Message-ID: <1208543185.22418.9.camel@sbarrow-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Array access on function returns From: sam@sambarrow.com (Sam Barrow) On Fri, 2008-04-18 at 10:40 -0700, Kalle Sommer Nielsen wrote: > 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: > > function ArrayTest(Array $range) > { > return($range); > } > > $range = Array(1337 => Array('Hello World')); > > echo ArrayTest($range)[1337}; I was just about to write an email asking this same exact question this afternoon. This could be very useful, I don't see any reason not to have it. > > I would really like to see this introduced in PHP sometime (Perhaps as > an extra addition to 5.3's new and sleek features). > > This is very useful in a few areas and can save a few lines of code > here and there. > > unfortunately Im not a C Programmer myself else I've would have > provided a patch for this =/ > > > Cheers > > Kalle Sommer Nielsen > Zend Certified Engineer > >