Re: How to get name of a variable?
| From: | Thomas Deliduka | Date: | Wed, 12 Jul 2000 15:56:43 +0000 |
| Subject: | Re: How to get name of a variable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6165@lists.php.net to get a copy of this message | ||
I found it interesting that on 7/12/00 11:49 AM Bernhard Fuerst said:
> is there any way to get the name of a variable?
> Just like gettype($var) returns the type of a variable I want to get the
> name of the variable.
Hmmm, Well, if you have another variable which contains the name of another
variable, such as...
you have a list of required fields in a form:
name
addr
city
state
and they're in an array $required
and you want to determine whether these fields are populated or not you can
do:
if ($$required[0]) { echo "Missing Name"; }
But I don't know how you can get the name of a variable otherwise.
--
Thomas Deliduka
IT Manager
-------------------------
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/