Whats the easiest way to convert array a to b
a= [['x'=>'a'], ['y'=>'b']]
b= ['x'=>'a', 'y'=>'b']
a and b are just two examples.
Whats the easiest way to convert array a to b
a= [['x'=>'a'], ['y'=>'b']]
b= ['x'=>'a', 'y'=>'b']
a and b are just two examples.
Using array_walk_recursive for arbitrary depth:
$b = [];
array_walk_recursive($a, function ($v, $k) use (&$b) { $new[$k] = $v; });
Using @splash58 trick with the spread operator if you have only one level deep:
$b = array_merge(...$a);