How to get values by key name in multidimensional array. You have to iterate it recursively. This is the first time I can use Iterator classes of PHP and I already can think multiple problems this could solve. So first step into Recursive Iterators of PHP.
Source code viewer
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($array)); foreach ($iterator as $key => $value) { if ($key === 'id') { $ids[] = $value; } } // Would return array(1, 3)Programming Language: PHP