Re: Miserable escape string problem
| From: | intra_test at roibm dot de | Date: | Thu, 05 Oct 2006 15:55:41 +0000 |
| Subject: | Re: Miserable escape string problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-242677@lists.php.net to get a copy of this message | ||
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 escapes the $.
Even then, why does it output the \?
Try this:
=========================================================
$var1 = 1;
$var2 = 2;
print("\{$var1: $var2}");
=========================================================
It will output: \{1: 2}
Why the \? Isn't it an escape character.
If you try to get me thinking that this is normal behaviour,
let's agree to disagree.
PS: I'd like to see an insider comment on this, eventually
explain the thought behind this implementation.
Kae Verens wrote:
because {$var1} is a valid syntactical construct? try this instead: '{'.$var1.': '.$var2.'}' Kae