I've got a multidimensional array of the format:
Array
(
[0] => Array
(
[course_prefix] => AERO
[0] => AERO
[course_number] => 101
[1] => 101
)
[1] => Array
(
[course_prefix] => AERO
[0] => AERO
[course_number] => 102
[1] => 102
)
[2] => Array
(
[course_prefix] => AERO
[0] => AERO
[course_number] => 201
[1] => 201
)
)
And I'm attempting to perform three operations:
- unset all elements with the [0] and [1] keys,
- Combine the [course_prefix] and [course_number] values in each subarray,
- Flatten to a single array
So that the end result is
Array
(
"AERO 101",
"AERO 102",
"AERO 201"
)
I understand that array_map
can combine two different arrays, and that unset
removes elements, but how can I perform the operations when everything is in the same multidimensional array - e.g. unsetting elements not at top level, and combining values?