1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
--TEST-- "Reference Unpacking - Foreach" list() --FILE-- <?php $coords = array(array(1, 2), array(3, 4)); foreach ($coords as [&$x, $y]) { $x++; $y++; } var_dump($coords); ?> --EXPECT-- array(2) { [0]=> array(2) { [0]=> int(2) [1]=> int(2) } [1]=> array(2) { [0]=> &int(4) [1]=> int(4) } }