I’m trying to get ids of an array with foreach:
$arrays = Array
(
[bike] => Array
(
[id] => 29
)
[car] => Array
(
[0] => Array
(
[id] => 190
)
[1] => Array
(
[id] => 222
)
)
[plan] => Array
(
[id] => 313
)
)
But some arrays are on 2nd level (car is this example).
I know I can do this for the first level:
foreach ($arrays as $array) {
$array['id']
}
And I can do this for the second level:
foreach ($arrays as $array => $value) {
$value['id']
}
But how to combine these methods with only one foreach?