[Solved] PHP Use array map to reOrder an array


You can simply use foreach instead like as

foreach($your_arr as &$v){
    $v = [$v["period"] => $v["way"]];
}
print_r($your_arr);

Or using array_map

$your_arr = array_map(function($v){ return [$v["period"] => $v["way"]]; },$your_arr);
print_r($your_arr);

solved PHP Use array map to reOrder an array