Re: variable names
| From: | Chris | Date: | Tue, 14 Nov 2000 23:10:22 +0000 |
| Subject: | Re: variable names | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25269@lists.php.net to get a copy of this message | ||
To clarify,
In this example you need to know the name of the variable to find the name
of the variable.
The only reason I can see this is you have some array of variables, but even
then that would be easy to get just using normal array stuff.
Unless you mean the type of, like is $myvar a string, int, etc.
> 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
>
>
> --
> 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