3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $input = array ( "group_name_1" => "audi", "group_locations_1" => "tokyo,barcelona,paris", "group_quantities_at_locations_1" => "1,2,7", "group_name_2" => "ford", "group_locations_2" => "london,prag", "group_quantities_at_locations_2" => "3,6" ); $result = []; array_walk(array_chunk($input,3),function($v)use(&$result){ $result[$v[0]] = array_combine(explode(",",$v[1]),explode(",",$v[2])); }); print_r($result);
Output for 7.0.0 - 7.2.0
Notice: Only variables should be passed by reference in /in/sRd1f on line 14 Array ( [audi] => Array ( [tokyo] => 1 [barcelona] => 2 [paris] => 7 ) [ford] => Array ( [london] => 3 [prag] => 6 ) )
Output for 5.4.12 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/sRd1f on line 14 Array ( [audi] => Array ( [tokyo] => 1 [barcelona] => 2 [paris] => 7 ) [ford] => Array ( [london] => 3 [prag] => 6 ) )
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/sRd1f on line 13
Process exited with code 255.