Dave Goodchild wrote:
Is this really worth all the keystrokes? Do we not have any more
valuable ways to spend our time?
Good point Dave. But on the wrong side.
By counting all the keystrokes the PHP developers have to type extra
for code like this:
"{{$foo}: {$bar}}"
'{'.$var1.': '.$var2.'}'
e
Richard Lynch wrote:
$curly = '{';
echo "$curly$var1: $var2}";
Horrendous workaround.
Google Kreme wrote:
> On 05 Oct 2006, at 11:37 , Chris Shiflett wrote:
>> Google Kreme wrote:
>>> So what is "{{$var1} : {$var2}}"
>>
>> Within a quoted string, you can surround variable names with braces fo
Google Kreme wrote:
On 05 Oct 2006, at 10:50 , [EMAIL PROTECTED] wrote:
So, yes, there is no escaping for { in PHP and that would be it.
So what is "{{$var1} : {$var2}}" ??
A workaround.
ciao
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.p
Either your mail client is broken, or you're misquoting him on purpose:
Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.
Thanks Chris, I already emailed him on private 'cause I didn't
want to clutter the list unneeded.
To address the original
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}");
==
Sorry tg, you missed the whole point. Read again.
The escaping works fine for me.. using the code:
$var1 = 1;
$var2 = 3;
echo "\$var1: $var2";
print "\$var1: $var2";
print ("\$var1: $var2");
All output:
$var1: 3
as expected.
Is there a way to re-define the escape character or something? I
Well Kae, if you reply 3 times let me also reply you once.
What you try to suggest is a workaround. A workaround should
not be needed for such a basic thing. Ever.
The point is, \ should escape only the {, just like
it does when you escape a variable like this "\$var1"
In this case, \ only escape
Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.
But why in the name of [whatever, too many to list] doesn't this one
below work?
"\{$var1: $var2}"
If \ is an escape character why does it also appear in the string output?
Why does the above \ escape {$var
8 matches
Mail list logo