Re: variable names

From: Date: Tue, 14 Nov 2000 23:06:48 +0000
Subject: Re: variable names
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25268@lists.php.net to get a copy of this message
I fail to see the point of this. Isn't this just $name = "myvar"; > On Tue, 14 Nov 2000, Jan-Eric Duden wrote: > > > Does anybody know if there is a function that returns the name of variable? > > I imagine something like this: > > > > $myvar="bla"; > > $name=GetVarName($myvar); > > > > $name=="myvar" > > There isn't really a function to do this that I know of. One (messy) > option could be to search $GLOBALS, but it'd be highly prone to being > unreliable. I probably wouldn't suggest using it, just thinking outloud. > > $myvar = 'blah' > > foreach ($GLOBALS as $key => $val) > { > if ($val == $myvar) > echo "Variable match: $key\n"; > } > > Matt > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#25268) next »