3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( "1" => Array ( "0" => "16/03/2018", "1" => "Friday", "2" => "21.00", "3" => "Friendly Match", "4" => "Italy vs France", "5" => "Truesports HD", ), "2" => Array ( "0" => "17/03/2018", "1" => "Saturday", "2" => "15.30", "3" => "Friendly Match", "4" => "Italy vs Pakistan", "5" => "Truesports HD", ), "3" => Array ( "0" => "17/03/2018", "1" => "Saturday", "2" => "19.00", "3" => "Friendly Match", "4" => "Spain vs USA", "5" => "Truesports" ) ); $array_keys= array("date","day","time","type","value","tv"); $new_array = array(); foreach ($array as $key => $value) { $tmp_array = array(); foreach ($value as $key1 => $value1) { $tmp_array[$array_keys[$key1]] = $value1; } $new_array[] =$tmp_array; } echo json_encode($new_array, JSON_PRETTY_PRINT);

preferences:
13.35 ms | 404 KiB | 5 Q