note 42013 deleted from function.var-dump by tomsommer

From: Date: Thu, 29 Apr 2004 09:31:03 +0000
Subject: note 42013 deleted from function.var-dump by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-68999@lists.php.net to get a copy of this message
Note Submitter: martin.rode@programmfabrik.de ---- Every wondered how your Arrays look like in HTML? This is prooved very helpful for me: function mr_dump($var,$level=0) { $styi = "border-collapse:collapse; vertical-align:top; font-size:10px; font-face:arial;"; $sty = "style='$styi'"; if ($level == 0) { echo "<table border=1 $sty>"; } echo "<tr>"; if (is_array($var)) { echo "<td $sty>"; $keys = array_keys($var); echo "<table border=0 $sty'>"; foreach ($keys as $key) { $i++; echo "<tr>"; echo "<td style='$styi text-align:right;'>"; echo "<b>'".htmlentities($key)."'</b>&nbsp;="; echo "</td>"; echo "<td>"; echo "<table border=1 $sty'>"; mr_dump($var[$key],$level+1); echo "</table>"; echo "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "<td style='$styi width:80; min-width:80; max-width:80;'>"; if (!isset($var)) { $null = "null"; } if (is_bool($var)) { if ($var) { $null = "false"; } else { $null = "true"; } } if (!$null) { echo htmlentities($var); } else { echo "<span style='color:red;'>$null</span>"; } } echo "</td>"; echo "</tr>"; if ($level == 0) { echo "</table>"; } flush(); }

« previous php.notes (#68999) next »