Re: Re: Variables within a string
| From: | Erik Price | Date: | Tue, 12 Mar 2002 15:50:07 +0000 |
| Subject: | Re: Re: Variables within a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88215@lists.php.net to get a copy of this message | ||
On Monday, March 11, 2002, at 10:34 PM, Jason Wong wrote:
I thought that it could be done like so: $foo = "Entry for {$HTTP_POST_VARS['name']}"; Sorry for butting in, Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.comInside of double-quoted strings there is no need to single-quote the array key (in fact it can't be done, gives syntax error). The section of the manual you quoted states this :)On Monday 11 March 2002 11:10, Chris Cocuzzo wrote:But that's not good programming. Associative arrays should have the key quoted in order to avoid confusion with contants. See http://www.php.net/manual/en/language.types.array.php#language.types.array. donts$foo = "Entry for " . $HTTP_POST_VARS["name"];$foo = "Entry for for $HTTP_POST_VARS[name]";