3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( array( 'x' => 0, 'y' => 1 ), array( 'x' => 2, 'y' => 3 ), array( 'x' => 0, 'y' => 1 ), array( 'x' => 2, 'y' => 3 ), array( 'x' => 0, 'y' => 1 ), array( 'x' => 2, 'y' => 3 ), array( 'x' => 0, 'y' => 1 ), array( 'x' => 2, 'y' => 3 ), array( 'x' => 0, 'y' => 1 ), array( 'x' => 2, 'y' => 3 ), array( 'x' => 0, 'y' => 1 ), array( 'x' => 2, 'y' => 3 ) ); foreach ($a as $id => $b) { $a[$id]['x'] += 10; $a[$id]['y'] -= 10; } print_r($a);
Output for 4.3.0 - 5.6.26, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Array ( [0] => Array ( [x] => 10 [y] => -9 ) [1] => Array ( [x] => 12 [y] => -7 ) [2] => Array ( [x] => 10 [y] => -9 ) [3] => Array ( [x] => 12 [y] => -7 ) [4] => Array ( [x] => 10 [y] => -9 ) [5] => Array ( [x] => 12 [y] => -7 ) [6] => Array ( [x] => 10 [y] => -9 ) [7] => Array ( [x] => 12 [y] => -7 ) [8] => Array ( [x] => 10 [y] => -9 ) [9] => Array ( [x] => 12 [y] => -7 ) [10] => Array ( [x] => 10 [y] => -9 ) [11] => Array ( [x] => 12 [y] => -7 ) )