So I got an array like:
Array
(
[0] => Array
(
[ids] => Array
(
[id] => id1
)
[name] => name1
[number] => 1
)
[1] => Array
(
[ids] => Array
(
[id] => id2
)
[name] => name2
[number] => 2
)
)
And I want to construct new multidimensional array based on the elements of it, but adding some new keys with empty values like(all the keys will have other names in new array, it's just simplified):
Array
(
[0] => Array
(
[id] => id1
[firstname] => name1
[lastname] =>
[somedata] =>
[somemoredata] =>
[ordernumber] => 1
)
[1] => Array
(
[id] => id2
[firstname] => name2
[lastname] =>
[somedata] =>
[somemoredata] =>
[ordernumber] => 2
)
)
How do I do it? Was thinking about array_push inside foreach loop, but it's not gonna do the job because of the empty keys I want and different order of elements. I also know how to access the nested value of [id] but still no idea about how to construct and move values to the new array for each element.