PHP 7.2.0 Beta 3 Released

Voting

Please answer this simple SPAM challenge: max(five, two)?
(Example: nine)

The Note You're Voting On

Anonymous
9 years ago
[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>';
?>

<< Back to user notes page

To Top