Return to Snippet

Revision: 9977
at December 2, 2008 06:33 by sidisinsane


Initial Code
// Recursively traverses a multi-dimensional array.
function traverseArray($array)
{ 
	// Loops through each element. If element again is array, function is recalled. If not, result is echoed.
	foreach($array as $key=>$value)
	{ 
		if(is_array($value))
		{ 
			traverseArray($value); 
		}else{
			echo $key." = ".$value."<br />\n"; 
		} 
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
Recursively traverse a Multi-dimensional Array

Initial Tags
php, array

Initial Language
PHP