RE: [PHP] Expand/parse variables in file
| From: | Jason Lustig | Date: | Tue, 26 Jun 2001 03:29:17 +0000 |
| Subject: | RE: [PHP] Expand/parse variables in file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55176@lists.php.net to get a copy of this message | ||
>$a = "whatever";
>$b = "abc $a def";
>echo $b;
>
>which results in "abc whatever def" ???
>
>What am I missing?
$b = "abc $a def";
That gets parsed because it's in double-quotes. Since $a is a variable, it
inputs whatever $a is, in this case "Whatever". So it ends up printnig out
"abc whatever def". To fix it, either escape the $a, or use single-quotes.
--Jason