note 84581 deleted from language.variables by cmb
| From: | cmb@php.net | Date: | Mon, 05 Nov 2018 12:53:06 +0000 |
| Subject: | note 84581 deleted from language.variables by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209627@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
[EDIT by danbrown AT php DOT net: The function provided by this author will give you all defined
variables at runtime. It was originally written by (john DOT t DOT gold AT gmail DOT com), but
contained some errors that were corrected in subsequent posts by (ned AT wgtech DOT com) and
(taliesin AT gmail DOT com).]
<?php
echo '<table border=1><tr> <th>variable</th> <th>value</th>
</tr>';
foreach( get_defined_vars() as $key => $value)
{
if (is_array ($value) )
{
echo '<tr><td>$'.$key .'</td><td>';
if ( sizeof($value)>0 )
{
echo '"<table border=1><tr> <th>key</th>
<th>value</th> </tr>';
foreach ($value as $skey => $svalue)
{
echo '<tr><td>[' . $skey
.']</td><td>"'. $svalue .'"</td></tr>';
}
echo '</table>"';
}
else
{
echo 'EMPTY';
}
echo '</td></tr>';
}
else
{
echo '<tr><td>$' . $key .'</td><td>"'.
$value .'"</td></tr>';
}
}
echo '</table>';
?>