3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $oldArray = range('a','e'); $newArray = array(); $len = count($oldArray); for($i = 0; $i < count($oldArray); $i+=2){ $key = $oldArray[$i]; $val = $i+1 < $len ? $oldArray[$i+1] : ''; $newArray[$key] = $val; }
Output for 4.3.0 - 7.1.0