Q:

in PHP how to change the key of an array with tke key of a nested array

I have an array with nested associative array for each element, like this:
array (size=47)
  0 => 
    array (size=1)
      'name' =>  'Saitama'
  1 => 
    array (size=1)
      'email' =>  'Saitama@onepunch.man'
  ...

I want to build a function that return an associative array like this:
array (size=47)
    'name' =>  'Saitama',
    'email' =>  'Saitama@onepunch.man'
  ...

I tried with array_map() and array_combine() but I cannot manage to do this job.
Thank you very much
Pasquale

A:

It's called flattening and just merge the nested arrays:
$result = call_user_func_array('array_merge', $array);

Obviously this only works with unique keys, as duplicates will be overwritten.

