3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array(1 => 5, 0 => 5); echo "first array\n"; print_r($array); $output = Array(); foreach ($array as $key => $value) { echo "$key => $value \n"; $output[] = array("id" => $key, "score" => $value); } echo "secont array\n"; print_r($output);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
first array Array ( [1] => 5 [0] => 5 ) 1 => 5 0 => 5 secont array Array ( [0] => Array ( [id] => 1 [score] => 5 ) [1] => Array ( [id] => 0 [score] => 5 ) )