note 53366 deleted from function.print-r by derick
| From: | derick@php.net | Date: | Thu, 27 Oct 2005 10:15:27 +0000 |
| Subject: | note 53366 deleted from function.print-r by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97671@lists.php.net to get a copy of this message | ||
Note Submitter: yehaimanish at no dot spam dot gmail dot com
----
Here is a function which will give more readability for the array compared to print_r();
<?
function formattedoutput($array) {
ksort($array);
reset($array);
echo "<table>";
foreach($array as $f_name=>$f_value) {
echo "<tr><td valign='top'><div align='right'>";
if(!$f_value) { echo "<font color='red'>"; }
echo $f_name;
if(!$f_value) { echo "</font>"; }
echo " :</div></td><td valign='top'><div
align='left'> ";
if(is_array($f_value)) {
formattedoutput($f_value);
} else {
echo $f_value;
}
echo "</div></td></tr>";
}
echo "</table>";
}
?>