Show Output
PHP Recursive Function
$count, 'values' => $items); } // Define nested array $species = array( "birds" => array( "Eagle", "Parrot", "Swan" ), "mammals" => array( "Human", "cat" => array( "Lion", "Tiger", "Jaguar" ), "Elephant", "Monkey" ), "reptiles" => array( "snake" => array( "Cobra" => array( "King Cobra", "Egyptian cobra" ), "Viper", "Anaconda" ), "Crocodile", "Dinosaur" => array( "T-rex", "Alamosaurus" ) ) ); // Count and print values in nested array $result = printValues($species); echo $result['total'] . ' value(s) found: '; echo implode(', ', $result['values']); ?>