3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 'red', 'green', 'blue' ); foreach ( $a as $k => $c ) { if ($c == 'red') { $a[$k] = 'purple'; } } var_dump($a);
based on Vh2O6
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
array(3) { [0]=> string(6) "purple" [1]=> string(5) "green" [2]=> string(4) "blue" }
Output for hhvm-3.10.0

Process exited with code 153.