$hitElement) { # If there is a element left if (is_array($hitElement)) { # call recursive structure to parse the $rowData recursiveArray($hitElement); } else { if ($key == 4) { switch($hitElement) { case 1: echo 'Calling fn();' . PHP_EOL; break; case 0: echo 'Calling differentfn();' . PHP_EOL; break; } } } } }