3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = array('red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'); foreach ($x as $key => $value) { echo $key.' '.$value."\n"; if (strlen($value) < 6) unset($x[$key]); }
based on VjpNn
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
0 red 1 orange 2 yellow 3 green 4 blue 5 indigo 6 violet