Search
Results
PHP recursion print all elements of a multidimensional array with keys - Stack Overflow
[https://stackoverflow.com/questions/14006609/php-recursion-print-all-elements-of-a-multidimensional-array-with-keys] - - public:mepage
function pretty_dump($arr, $d=1){ if ($d==1) echo "<pre>"; // HTML Only if (is_array($arr)){ foreach($arr as $k=>$v){ for ($i=0;$i<$d;$i++){ echo "\t"; } if (is_array($v)){ echo $k.PHP_EOL; Pretty_Dump($v, $d+1); } else { echo $k."\t".$v.PHP_EOL; } } } if ($d==1) echo "</pre>"; // HTML Only }