3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array['dump'] = 'dump'; $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 $index => &$ids ) { if( $index == 2 ) { $ids['new'] = $ids['val']; } else { $ids['new'] = ''; } } print_r($array); $array['ids'] = array_values($array['ids']); print_r($array);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [dump] => dump [ids] => Array ( [0] => Array ( [id] => 1 [val] => one [new] => ) [2] => Array ( [id] => 2 [val] => two [new] => two ) [1] => Array ( [id] => 3 [val] => three [new] => ) ) ) Array ( [dump] => dump [ids] => Array ( [0] => Array ( [id] => 1 [val] => one [new] => ) [1] => Array ( [id] => 2 [val] => two [new] => two ) [2] => Array ( [id] => 3 [val] => three [new] => ) ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.96 ms | 403 KiB | 8 Q