[thelist] PHP - Variables in a literal string

John Meyer john_meyer at geocities.com
Sat Jun 2 00:06:39 CDT 2001


Use double quotes instead of single quotes

At 01:00 AM 6/2/01 -0400, you wrote:
>The following is just an example, I know that if the situation were similar
>to the example that there would be much better ways of accomplishing the
>task.  The example, however, is for simplicity's sake.
>
>// Ok, say I have a variable:
>$foo = 'hi there';
>
>// And I have a literal string:
>$moo = 'I would like to say $foo';
>
>When echoed, the variable $moo says exactly what I typed... my question is
>this: How can I make it evaluate the $moo string so that when echoed, it
>will display "I would like to say hi there"?
>
>I know there is an eval() function in PHP, and I've read the entry in the
>manual on it, but there must be some concept I'm not grasping or something
>I've overlooked, because I haven't been able to make it work this way.
>
>Thanks as always,
>- Linus
>
>
>---------------------------------------
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list