Re: Miserable escape string problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, October 5, 2006 11:37 am, intra_test@xxxxxxxx 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?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux