PHP 4.0 Bug #4471: Variable Variables not referenced in echo()/print()
| From: | tswan at ics dot olemiss dot edu | Date: | Tue, 16 May 2000 21:47:37 +0000 |
| Subject: | PHP 4.0 Bug #4471: Variable Variables not referenced in echo()/print() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18845@lists.php.net to get a copy of this message | ||
From: tswan@ics.olemiss.edu
Operating system: RedHat 6.0 Linux 2.2.15/Apache 1.3.12
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Scripting Engine problem
Bug description: Variable Variables not referenced in echo()/print()
I assume that I should can type echo "<B>$foo</B>", I should be able to type
echo "<B>$$reference_to_foo</B>"
This doesn't work...
Also...
echo "Hi! $$var";
should be equivalent to
echo "Hi! " . $$var;
unless I am mistaken...
Included below is a snippet which gives an example...
/*************************************************/
<PRE>
<?
$bob = "Bob Smith";
$variable_name = 'bob';
$variable_value = $$variable_name;
echo "These should all be the same\nBut... they aren't...\n\n";
echo "\"$variable_value\" == \"$$variable_name\"\n";
echo "\"" . $variable_value . "\" == \"" . $$variable_name .
"\"\n";
echo "\n";
print ("\"$variable_value\" == \"$$variable_name\"\n");
print ("\"" . $variable_value . "\" == \"" . $$variable_name .
"\"\n");
?>
</PRE>
/*************************************************/
Produces:
These should all be the same
But... they aren't...
"Bob Smith" == "$bob"
"Bob Smith" == "Bob Smith"
"Bob Smith" == "$bob"
"Bob Smith" == "Bob Smith"
/*************************************************/