3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array['ids'] = array( '0' => array( 'id' => 1, 'val' => 'one'), 'delete' => 3, '2' => array( 'id' => 2, 'val' => 'two'), '1' => array( 'id' => 3, 'val' => 'three')); unset($array['ids']['delete']); foreach( $array['ids'] as $ids ) { $ids['new'] = 'new'; } print_r($array); $array['ids'] = array_values($array['ids']); print_r($array);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [ids] => Array ( [0] => Array ( [id] => 1 [val] => one ) [2] => Array ( [id] => 2 [val] => two ) [1] => Array ( [id] => 3 [val] => three ) ) ) Array ( [ids] => Array ( [0] => Array ( [id] => 1 [val] => one ) [1] => Array ( [id] => 2 [val] => two ) [2] => Array ( [id] => 3 [val] => three ) ) )