function process($array) { foreach ($array as $key=>$value) { // Process the content of the array } if (isset($array[8])) // If we have linked arrays foreach($array[8] as $subArray) process($subArray); }