Entry
How can I print a table of all the global variables in my PHP script?
Jun 30th, 1999 20:49
Nathan Wallace, Chris Lott
You can use something like the following to dump all the global
variables into a HTML table:
<TABLE CELLPADDING="5" BORDER="1">
<TR><TH ALIGN="LEFT">Variable</TH><TH ALIGN="LEFT">Value</TH></TR>
<?
while (list($key, $value) = each($GLOBALS)) {
if (strtolower($key) != "globals") {
echo "<TR><TD><I>" . $key . "</I></TD><TD>$value";
if (strlen($value) == 0) {
echo " ";
}
echo "</TD></TR>\n";
}
}
?>
</TABLE>