Re: Miserable escape string problem
| From: | Richard Lynch | Date: | Thu, 05 Oct 2006 18:51:17 +0000 |
| Subject: | Re: Miserable escape string problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242701@lists.php.net to get a copy of this message | ||
On Thu, October 5, 2006 11:37 am, intra_test@roibm.de wrote:
> John Wells wrote:
> ....
>> Excerpt:
>> Since you can't escape '{', this syntax will only be recognised when
>> the $ is immediately following the {. (Use "{\$" to get a literal
>> "{$").
>>
>> Does that help?
>
> Not really, John.
> ===============================
> $var1 = 1; $var2 = 2;
> print("{\$var1: $var2}");
> ===============================
>
> will output "{$var1: 2}". I need this output "{1: 2}".
> What I need is an escape character for the {, but it looks like
> PHP doesn't have any.
$curly = '{';
echo "$curly$var1: $var2}";
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?