Merge php array merge without removing array key

时间:2015-05-24 22:15:54

标签: php

I have arrays like this.

Array ( 
[title] => Array ( [0] => Value1 ) 
[description] => Array ( [0] => Value1 )
) 

but i want the arrays to be look like this.

Array ( [title] => Value1 [description] => Value1 ) 

1 个答案:

答案 0 :(得分:6)

Simply

$array = array_map(function ($element) {
   return $element[0];
}, $array);

Test: http://3v4l.org/qd2eG