A bit stuck with $$
| From: | Neil | Date: | Fri, 27 Aug 2004 04:09:47 +0000 |
| Subject: | A bit stuck with $$ | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194888@lists.php.net to get a copy of this message | ||
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
-------------------------------------------------------------