3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arrStart = [ 0 => [ "start" => "04/26/2015 8:00 AM", ], 1 => [ "start" => "04/26/2015 9:00 AM", ], ]; $arrEnd = [ 0 => [ "end" => "04/26/2015 10:00 AM", ], 1 => [ "end" => "04/26/2015 11:00 AM", ], ]; $keys = [ 0 => "1", 1 => "3", ]; $result = []; foreach ($keys as $i => $key) { $result[$key] = [ 'start' => $arrStart[$i]['start'], 'end' => $arrEnd[$i]['end'], ]; } var_dump($result);
based on GoWiV
Output for 5.4.0 - 7.2.0
array(2) { [1]=> array(2) { ["start"]=> string(18) "04/26/2015 8:00 AM" ["end"]=> string(19) "04/26/2015 10:00 AM" } [3]=> array(2) { ["start"]=> string(18) "04/26/2015 9:00 AM" ["end"]=> string(19) "04/26/2015 11:00 AM" } }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/HDRHF on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/HDRHF on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/HDRHF on line 3
Process exited with code 255.