RE: [PHP] Parsing variables within string variables
| From: | Jay Blanchard | Date: | Fri, 07 Apr 2006 17:12:26 +0000 |
| Subject: | RE: [PHP] Parsing variables within string variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-233450@lists.php.net to get a copy of this message | ||
[snip]
I have a variable containing a string that contains the names of
variables, and want to output the variable with the variables it
contains evaluated. E.g.
$foo contains 'cat'
$bar contains 'Hello $foo'
and I want to output $bar as
Hello cat
The problem is that if I use
echo $bar
I just get
Hello $foo
[/snip]
$bar = 'Hello' . $foo;