Re: Miserable escape string problem
| From: | John Wells | Date: | Thu, 05 Oct 2006 16:23:01 +0000 |
| Subject: | Re: Miserable escape string problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242682@lists.php.net to get a copy of this message | ||
On 10/5/06, intra_test@roibm.de <intra_test@roibm.de> wrote:
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 {$var1 and not only the {? Miserable.First up: http://uk2.php.net/manual/en/language.types.string.php#language.types.string.syntax.double Excerpt: Again, if you try to escape any other character, the backslash will be printed too! Before PHP 5.1.1, backslash in \{$var} hasn't been printed. Then: http://uk2.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex 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? HTH, John W