Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?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);