Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32692 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54792 invoked by uid 1010); 7 Oct 2007 23:44:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 54777 invoked from network); 7 Oct 2007 23:44:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2007 23:44:35 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:35820] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/32-31471-16F69074 for ; Sun, 07 Oct 2007 19:44:34 -0400 Received: from trainburn-lm-corp-yahoo-com.local (74-136-217-200.dhcp.insightbb.com [74.136.217.200]) (authenticated bits=0) by mail.lerdorf.com (8.14.1/8.14.1/Debian-10) with ESMTP id l97NiQZG017305 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 7 Oct 2007 16:44:27 -0700 Message-ID: <47096F5D.2010508@lerdorf.com> Date: Sun, 07 Oct 2007 18:44:29 -0500 User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Emil Hernvall CC: internals@lists.php.net References: <200710042005.30734.larry@garfieldtech.com> <285930281.20071006200938@marcus-boerger.de> <200710061338.47307.larry@garfieldtech.com> <4707D8AA.9060905@daylessday.org> <4707ED46.6040206@daylessday.org> <3b46aad60710071639x579be029ta36868b1715cbc0@mail.gmail.com> In-Reply-To: <3b46aad60710071639x579be029ta36868b1715cbc0@mail.gmail.com> X-Enigmail-Version: 0.95.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/4498/Sun Oct 7 13:42:27 2007 on colo.lerdorf.com X-Virus-Status: Clean Subject: Re: [PHP-DEV] substr/array_slice in [] From: rasmus@lerdorf.com (Rasmus Lerdorf) Emil Hernvall wrote: > On a related note. Code like: > > $foo = array("a" => range(1,10), "b" => range(11,20)); > print_r($foo[][0]); > > results in > > Fatal error: Cannot use [] for reading in Command line code on line 3 > > It would be incredibly useful when handling regular two-dimensional > database-resultsets. Essentially, what I'm after is things like this: > > $result = $pdo->fetchAll(PDO::FETCH_ASSOC); > $result = array_combine(result[]['my_id'], $result); > > If I prepared a patch that made this possible, would it be considered > for inclusion? Is there any issues I've overlooked or other > objections? Yes, I object on the basis that I have no idea what that syntax should do by looking at it. The auto-incrementing [] array syntax has always been a write-only construct. Auto-incrementing on a read doesn't make any sense which means you are overloading that syntax to mean something completely different. -Rasmus