3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = array('item1', 'item2'); foreach ($x as $key => $value) { echo $key.' '.$value."\n"; if ($key == 0) unset($x[$key]); if ($key == 1) $x[$key] = 'item2changed'; } print_r($x);

preferences:
36.06 ms | 402 KiB | 5 Q