Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69811 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96539 invoked from network); 23 Oct 2013 18:07:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2013 18:07:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 198.187.29.241 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.241 imap3-1.ox.registrar-servers.com Received: from [198.187.29.241] ([198.187.29.241:58972] helo=imap3-1.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/A4-10840-35018625 for ; Wed, 23 Oct 2013 14:07:15 -0400 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id 727072A0078 for ; Wed, 23 Oct 2013 14:07:13 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap3.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap3.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QHzkxe1rmAdv for ; Wed, 23 Oct 2013 14:07:13 -0400 (EDT) Received: from [192.168.0.200] (unknown [94.3.245.95]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id DB3E12A006F for ; Wed, 23 Oct 2013 14:07:12 -0400 (EDT) Message-ID: <52681047.7080904@ajf.me> Date: Wed, 23 Oct 2013 19:07:03 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:25.0) Gecko/20100101 Thunderbird/25.0 MIME-Version: 1.0 To: PHP internals References: <52680C60.7080305@ajf.me> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal: Implement FR #7930 (list() constructor reference assignment) From: ajf@ajf.me (Andrea Faulds) On 23/10/2013 19:03, Matthew Leverton wrote: > Seems like a natural fit to me. > > Does it also work with the new foreach/list combo? > > foreach ($array as list(&$a, $b)) {} > Somehow I managed to forget to test that. Apparently, it does: ajf@raspberrypi ~/PHP/php-src $ sapi/cli/php -r '$arr = [[1,2],[3,4]]; foreach ($arr as list(&$a, $b)) $a = 7; var_dump($arr);' array(2) { [0]=> array(2) { [0]=> int(7) [1]=> int(2) } [1]=> array(2) { [0]=> &int(7) [1]=> int(4) } } I should probably add a test for this. -- Andrea Faulds http://ajf.me/