<?php
$input = array (
'bike' =>
array (
'id' => 29,
'type' => 'a',
'time' => '9',
),
'car' =>
array (
0 =>
array (
'id' => 189,
'type' => 'b',
'time' => '18',
),
1 =>
array (
'id' => 190,
'type' => 'c',
'time' => '14',
),
),
'plane' =>
array (
'id' => 313,
'type' => 'd',
'time' => '20',
),
);
$output = [];
array_walk_recursive($input, function($value, $key) use (&$output) {
if ($key == "id") {
$output[] = $value;
}
}, $output);
var_export($output);
preferences:
23.02 ms | 405 KiB | 5 Q