PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $arr = [ [ "0_mass" => 0.0, "0_arm" => 287.02, "0_max_limit" => 0.0, "0_is_dom" => 0, ], [ "1_mass" => 0.0, "1_arm" => 269.24, "1_max_limit" => 0.0, "1_is_dom" => 0, ], ]; $keys = array_map(function ($el) { $split = explode("_", $el); array_shift($split); return implode("_", $split); }, array_keys($arr[0])); //var_export($keys); $res = array_map( function($el) use ($keys) { return array_combine($keys, array_values($el)); }, $arr ); var_export($res);
Show:  
Copy Clear