Re: Can i take the variable name in a function?
| From: | Richard Lynch | Date: | Wed, 11 Oct 2006 20:04:34 +0000 |
| Subject: | Re: Can i take the variable name in a function? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243001@lists.php.net to get a copy of this message | ||
On Wed, October 11, 2006 2:21 pm, Richard Lynch wrote:
> If you really really really know what you are doing, you can do this:
And if you make no typos like I just did... :-)
> function example($name){
// > global $name; //Whoops!
global $$name; //note the TWO $ symbols!
>
> echo "The variable $name has the value: ", $$name;
> }
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?