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][0], 'end' => $arrEnd[$i][0], ]; } var_dump($result);
based on mfZ1s
Output for 5.4.0 - 7.2.0
Notice: Undefined offset: 0 in /in/GoWiV on line 30 Notice: Undefined offset: 0 in /in/GoWiV on line 31 Notice: Undefined offset: 0 in /in/GoWiV on line 30 Notice: Undefined offset: 0 in /in/GoWiV on line 31 array(2) { [1]=> array(2) { ["start"]=> NULL ["end"]=> NULL } [3]=> array(2) { ["start"]=> NULL ["end"]=> NULL } }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/GoWiV 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/GoWiV on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/GoWiV on line 3
Process exited with code 255.