Re: A bit stuck with $$
| From: | Jasper Howard | Date: | Fri, 27 Aug 2004 16:53:38 +0000 |
| Subject: | Re: A bit stuck with $$ | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194945@lists.php.net to get a copy of this message | ||
i found this a bit confusing, why were you putting $$ infront of a variable
instead of just $?
--
-------------------------------------------------------------->>
Jasper Howard :: Database Administration
Velocity7
1.530.470.9292
http://www.Velocity7.com/
<<--------------------------------------------------------------
"Neil" <neil@markel.com.au> wrote in message
news:6.1.1.1.2.20040827134210.02df9370@mail.glennies.com.au...
>
>
> Not sure if its me or the configuration of PHP
>
> I am trying to get the value of a variable, a variable variable
>
> ie
>
> // From Form
> $name = "My Name";
> -----------------------------------
>
> // from a list of values in a file
> $var="name";
>
> $value=$$var;
> i// I thought I could do something as simple as this to get the correct
> value "My Name" into $value.
>
> print " $value ";
> // should print "My Name", I zip.
>
> I have played around with this bit of code from operators part of the
> manual and this does not appear to work, well for me at least.
>
> $foo = "test";
> $$bar = "this is";
>
> echo "${$bar} $foo"; // prints "this is test"
> Note: it is the same as
> echo "$test $foo"; // ***** for me it only prints out "test"
>
>
> Any Ideas
>
> Cheers
>
> Neil
>
>
>
>
>
>
>
>
>
>
>
> Regards
>
> Chester Cairns
> -------------------------------------------------------------