3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
array ( 0 => 29, 1 => 189, 2 => 190, 3 => 313, )

preferences:
66.94 ms | 406 KiB | 5 Q