Req #63744 [Opn->Dup]: references in list()
Edit report at https://bugs.php.net/bug.php?id=63744&edit=1
ID: 63744
Updated by: nikic@php.net
Reported by: ninzya at inbox dot lv
Summary: references in list()
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: Any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #7930 (albeit with a different syntax suggestion).
Previous Comments:
------------------------------------------------------------------------
[2012-12-11 18:39:33] ninzya at inbox dot lv
Description:
------------
Would be good to have a possibility to extract array elements by ref like in test
script.
Test script:
---------------
$arr = array( 1, 2 );
list( &$first, &$second ) = $arr;
++$first;
--$second;
print_r( $arr);
Expected result:
----------------
array( 2, 1 )
Actual result:
--------------
PHP Parse error: syntax error, unexpected '&', expecting ',' or
')' in ... on
line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63744&edit=1
Thread (2 messages)