An alternative to print_r, this function will print an array
with HTML and Syntax highlighting. Could easily be extended to
support 3D arrays.
USAGE: echo f_arr($_SESSION);
matthew waygood wrote :968
single dimension arrays only then.
If you called the function from within itself then it would recurrsively step through it and get the entire contents.
foreach($arr as $k=>$v){
if (isarray($v){
$out[] = "array ".$k."[".f_arr($V)."]";
} else {
$out[] = $l.$fb.$k.$fe.$r.$a.$fr.$v.$fe;
}
}
This method takes longer and more memory than just doing print_r but it gves you the formatting you require.
Aaron Holmes wrote :971
To finalize a version for printing multi-dimensional arrays you can use something like the following: (formatting may be required)
<?php
// An alternative to print_r, this function will print an array
// with HTML and Syntax highlighting. Could easily be extended to
// support 3D arrays.
// USAGE: echo f_arr($_SESSION);
// Revised for multi-dimensional arrays
// Aaron Holmes <aholmes@pureguru.com>