On Feb 8, 2008 10:25 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:
>
> On Feb 8, 2008, at 10:14 AM, tedd wrote:
>
> > Hi gang:
> >
> > From a variable with the name of $this_variable -- how do I get a
> > string 'this_variable' ?
>
>
> Hey tedd,
>
> What is the end result you want? for debugging and checking variable
> contents, I've simply: echo "this_variable = $this_variable";
>
> But that was just for debugging, in a large environment, it could be
> quite tedious to type all that out...
What Tedd means is this: ;-P
<?
function vname(&$var,$scope=false,$prefix='unique',$suffix='value') {
if($scope) {
$vals = $scope;
} else {
$vals = $GLOBALS;
}
$old = $var;
$var = $new = $prefix.rand().$suffix;
$vname = FALSE;
foreach($vals as $p => $v) {
if($v === $new) {
$vname = $p;
}
}
$var = $old;
return $vname;
}
?>
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php