I am trying to turn the following array
Array
(
[0] => Array
(
[535fd7566a10d96c2ac04d2e26e210c4] => Jane Apple
)
[1] => Array
(
[3cdacd430d6a70acbe4caf9712a76824] => Johnny Apple
)
...
)
into the following format.
Array
(
[535fd7566a10d96c2ac04d2e26e210c4] => Jane Apple,
[3cdacd430d6a70acbe4caf9712a76824] => Johnny Apple,
...
)
I have tried a few different functions found through the stack-overflow, and google but no luck.
Anyone have any ideas on how I can achieve my desired result?
Thank you,
I believe
array_reduce($array, 'array_merge', [])
should do the trick
essentially you want to reduce an array of values (each an array) to one value (an array) hence array_reduce. and merge takes an item (the array) and merges it with another array (the carry in this case) to produce the array you want.
just wanted to provide a non-loop answer ;o)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With