Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53156 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31002 invoked from network); 7 Jun 2011 15:50:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jun 2011 15:50:25 -0000 Authentication-Results: pb1.pair.com header.from=landeholm@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=landeholm@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: landeholm@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:33743] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/13-15404-1C84EED4 for ; Tue, 07 Jun 2011 11:50:25 -0400 Received: by iyb12 with SMTP id 12so5203202iyb.29 for ; Tue, 07 Jun 2011 08:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=1xpggtyPhBzJSN2qqvzoKzUSwt1jWW6W4hapusrLrk8=; b=jRlYXGAbk3XLifzZDRtwb1/MrfvYgyYTnZEKBuUw6wKgA13AyqSlUmTgXA4ITQghZc iZVgo3GAEzt1u6CLGhhpnFJOJiApAKOJPx0MCNAAIvIL/Fac2Kt8aNmK/UcqgAqvi8f6 YjKv2QuxDG8ySRHdSJgH3Yb4ySpuDTHlsJO68= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=l2gqJFJT7Z//jRzOyQt9Bp2Fzg3G5+5Kdv5oBwvlTeSddt9gd+64FrIb5txzplUaxD hbkKiz4br8UxxhY+t2xccxEoD27E5lhCYQXOVlKhiaGFm8t/0eatIs/PfICTVLWOsR2V kq5wQTRgXjlLnWg369zbn3kuClxKcplWhJfK8= MIME-Version: 1.0 Received: by 10.231.215.93 with SMTP id hd29mr10369354ibb.174.1307461822814; Tue, 07 Jun 2011 08:50:22 -0700 (PDT) Received: by 10.231.33.66 with HTTP; Tue, 7 Jun 2011 08:50:22 -0700 (PDT) In-Reply-To: References: Date: Tue, 7 Jun 2011 17:50:22 +0200 Message-ID: To: John Crenshaw , internals@lists.php.net Content-Type: multipart/alternative; boundary=000e0cd4889e819ac404a5212d30 Subject: Re: [PHP-DEV] Inline constructing/cloning and inline foreach listing From: landeholm@gmail.com (Hannes Landeholm) --000e0cd4889e819ac404a5212d30 Content-Type: text/plain; charset=ISO-8859-1 On 7 June 2011 15:53, John Crenshaw wrote: > > foreach ($arrays as list($e1, $e2, $e3)) { ... > > Disagree. This feels very obtuse. I wouldn't expect this construct to work > at all, and even if it did, it is highly ambiguous (I.E. at first I thought > you were intending to grab 3 entries at a time, rather than extracting > entries from a second array). > > John Crenshaw > Priacta, Inc. > I don't understand what's ambiguous? For each iteration the foreach assigns the current value to the variable $value specified as either "as $key => $value" or "as $value". The "as" keyword is simply a type of assignment operator that assigns the current element to the right expression. Since PHP has a special "list()" language construct for assignment it doesn't make sense that "list(...) = $something" assignment would work but not "array($something) as list(...)". Grabbing "3 elements at a time" is not logical at all. Why would the list construct change how the foreach iterates? Hannes --000e0cd4889e819ac404a5212d30--