Re: Miserable escape string problem

From: Date: Thu, 05 Oct 2006 23:21:37 +0000
Subject: Re: Miserable escape string problem
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-242737@lists.php.net to get a copy of this message
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 for clarity. This is especially helpful for situations like this, where the rest of the string interferes with syntax.
Heh. It was a rhetorical question. He said there was no way to escape the {'s Of course there is... that was my point. I suggest you bring yourself up to speed on what escaping really means.
Your suggestion under no circumstances escaping. Actually, PHP Documentation does mention it: "Since you can't escape '{', this syntax...." See here(thanks go John Wells for posting about it): http://uk2.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex Now you may go on a rampage about what escaping means, but honestly, I don't want to hear about it. Richard Lynch wrote:
The whole thing with {} inside a string has always struck me as a total hack to fix something that wasn't broken in the first place, and I can never get it to do what I want. "Don't use it" is my solution. :-) Bingo. That is what I am trying to do. But I am not allowed since there
is no escaping for this thing. Thanks all for the replies. My intention was to bring to light YA PHP design problem. Looks to me like I didn't really succeed, but at least it's out. Regards

« previous php.general (#242737) next »