Posted by Ewoud Dronkert on 10/22/99 11:40
Dawsons wrote:
> Is it possible to echoe thew ACTUAL variable name into a document
function getvarname(&$var)
{
$ret = '';
$tmp = $var;
$var = md5(uniqid(rand(), TRUE));
$key = array_keys($GLOBALS);
foreach ( $key as $k )
if ( $GLOBALS[$k] === $var )
{
$ret = $k;
break;
}
$var = $tmp;
return $ret;
}
$another = 'test';
$testvar = 'test';
echo getvarname($testvar); //echoes 'testvar'
--
E. Dronkert
[Back to original message]
|