I have tried the array_reduce and array_merge methods but they don’t seem to do what I expected. Is there a way of doing this without a foreach?
I need to convert an array such as:
Array
(
[0] => Array
(
[id] => 2
)
[1] => Array
(
[id] => 3
)
[2] => Array
(
[id] => 4
)
)
Into:
Array
(
[0] => 2
[1] => 3
[2] => 4
)
You could use
array_mapNot this is for php 5.3. If you are using 5.2 youll have to define a function or use
create_functioninstead of passing in an anonymous like i have here.