note 6010 deleted from function.str-repeat by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 11:51:48 +0000 |
| Subject: | note 6010 deleted from function.str-repeat by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24237@lists.php.net to get a copy of this message | ||
I use it for displaying data in arrays in a readable
format with indentation for nested data. ie.
function recurseDisplay( $data, $depth = 0 )
{
if( !is_array( $data ) )
return;
for( $i = 0; $i < count( $data ); $i++ )
{
echo "\n"
.str_repeat( ' ', $depth * 4 )
.$data[$i];
recurseDisplay( $data[$i], $depth + 1 );
}
}
Note: the above code is an example I didn't
bother to test it.