3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $oldArray = array('a','b','c','d'); $newArray = array(); for($i = 0; $i < count($oldArray); $i+=2){ $key = $oldArray[$i]; $val = $oldArray[$i+1]; $newArray[$key] = $val; } var_dump($newArray);
Output for 4.3.0 - 7.1.0
array(2) { ["a"]=> string(1) "b" ["c"]=> string(1) "d" }