Reputation: 1037
How can I convert this array:
Array
(
[0] => Array
(
[Guy] => he
)
[1] => Array
(
[Girl] => she
)
)
to this one:
Array
(
[Guy] => he,
[Girl] => she
)
I tried implode()
, but it did not work.
Upvotes: 0
Views: 43
Reputation: 40909
The code below will do the trick:
$result = [];
foreach($yourArray as $innerArray) {
$result = array_merge($result, $innerArray);
}
Upvotes: 4