RE: [PHP] retriving a variable name
| From: | Matt Giddings | Date: | Wed, 23 Oct 2002 03:26:48 +0000 |
| Subject: | RE: [PHP] retriving a variable name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121028@lists.php.net to get a copy of this message | ||
Thanks for the info. I was just wondering, I couldn't find anything in
the documentation about it but thought that I may have missed it
somewhere.
Matt
> -----Original Message-----
> From: Maxim Maletsky [mailto:maxim@php.net]
> Sent: Tuesday, October 22, 2002 8:53 AM
> To: Marek Kilimajer
> Cc: PHP
> Subject: Re: [PHP] retriving a variable name
>
>
> This is not possible. Use arrays instead, it will require you to
change
> the logic within your application.
>
> --
> Maxim Maletsky
> maxim@php.net
>
> www.PHPBeginner.com // where PHP Begins
>
>
>
> Marek Kilimajer <kilimajer@webglobe.sk> wrote... :
>
> > If I understand you correctly, this is not possible, but na easy
> > workaroud is to call your function like this:
> > func(compact('varname')), which will give you an array( 'varname'
> > =>
> > 'varvalue') in your function.
> >
> > Matt Giddings wrote:
> >
> > >Is there a way to retrieve the variable name from within php?
> > >
> > >Example:
> > >
> > >$myvar = 'test';
> > >
> > >I want to be able to pass '$myvar' to a function and retrieve both
the
> > >name of the variable 'myvar' and the value of the variable 'test'
in
> > >this case.
> > >
> > >Thanks,
> > >Matt
> > >
> > >---
> > >Outgoing mail is certified Virus Free.
> > >Checked by AVG anti-virus system (http://www.grisoft.com).
> > >Version: 6.0.399 / Virus Database: 226 - Release Date: 10/9/2002
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.399 / Virus Database: 226 - Release Date: 10/9/2002
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.399 / Virus Database: 226 - Release Date: 10/9/2002