Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30004 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86396 invoked by uid 1010); 31 May 2007 20:22:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 86381 invoked from network); 31 May 2007 20:22:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 May 2007 20:22:29 -0000 Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain l-i-e.com from 67.139.134.202 cause and error) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:2364] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/60-17260-38E2F564 for ; Thu, 31 May 2007 16:22:28 -0400 Received: (qmail 62541 invoked by uid 98); 31 May 2007 20:22:29 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.01 (clamdscan: 0.88.7/3335. Clear:RC:1(127.0.0.1):. Processed in 2.252945 secs); 31 May 2007 20:22:29 -0000 Received: from localhost (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 31 May 2007 20:22:24 -0000 Received: from 216.230.84.67 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Thu, 31 May 2007 15:22:24 -0500 (CDT) Message-ID: <55264.216.230.84.67.1180642944.squirrel@www.l-i-e.com> In-Reply-To: <44409.30896.qm@web32613.mail.mud.yahoo.com> References: <44409.30896.qm@web32613.mail.mud.yahoo.com> Date: Thu, 31 May 2007 15:22:24 -0500 (CDT) To: "stefano federici" Cc: internals@lists.php.net, "stefano federici" Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] theoretical PHP arrays From: ceo@l-i-e.com ("Richard Lynch") On Wed, May 30, 2007 5:02 pm, stefano federici wrote: > I trying to find a reason why array functions are not allowed to be > used as normal arrays. To clarify, I'm allowed to write > > $arr = array( "maria", "mario", "luigi", "luisa"); > echo $arr[1]; > > but I'm not allowed to write > > echo array( "maria", "mario", "luigi", "luisa")[1]; > > In PHP documentation I read that "array" is a language construct, not > a function. So this may be the reason. But I also tried with > > echo (explode (" ", "maria mario luigi luisa"))[1]; > > and this doesn't work either (even if "explode" is a function). Not > surprisingly, > > $arr = explode (" ", "maria mario luigi luisa"); > echo $arr[1]; > > does work. So, if I can straightforwardly divide by, say, 2 the > integer output by a function, why shouldn't I be allowed to > straightforwardly use the array output by a function? > > This is not something completely weird that I'm asking. In Visual > Basic (that I know mustn't be the most loved programming language for > PHP users) you can say > > print array( "maria", "mario", "luigi", "luisa")(1) > > Maybe is THIS the reason why it doesn't work in PHP? ;-) > > Thanks for your consideration and help It was discussed last month, but as I recall, some nasty "what if" scenarios cropped up, and nobody came up with a reasonable way to do this... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?