var vars in quotes - bug or feature?
| From: | Dana dot Reed at clinicaldatacare dot com | Date: | Wed, 06 Sep 2000 18:30:19 +0000 |
| Subject: | var vars in quotes - bug or feature? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15545@lists.php.net to get a copy of this message | ||
Okej, let's say $bar is the jth element of array $foo and
$bar = VALUE;
If we do the following:
echo $$foo[$j]; //var var
echo "$$foo[$j]"; //var var in quotes
we get 'VALUE' and '$bar', respectively,
which are 'expected' and 'screwy', respectively...
I came across this months ago, and have been concatenating var vars with text to keep them out of
quotes ever since, but it would be nice to have another solution, especially in nasty SQL
statements. I thought some combination of {} might work if it was an ambiguity problem, but no
luck. Any ideas?
med vänlig hälsning
/Dana