Zend - The PHP Company




Utilities

Add Code


echoTab  

Type: code fragment
Added by: remz
Entered: 17/09/2002
Last modified: 09/12/2001
Rating: - (fewer than 3 votes)
Views: 3987
This little recursive function prints all the content of nested arrays and is very, very helpful for debugging.


<?php
function echoTab ($tab$nest=0){
    if (
is_array ($tab)){
        
reset($tab);
        while (list(
$key$val) = each($tab)){
            for (
$i=0$i<$nest$i++) print "&nbsp;&nbsp;";
                print 
"<b>$key</b> : $val<br>";
                if (
is_array ($val)) echoTab ($val$nest+2);
        }
    }
}

?>


Usage Example




Rate This Script





Search



This Category All Categories