#36061 [Opn->Bgs]: Escape {$var} not working

From: Date: Fri, 08 Sep 2006 17:24:19 +0000
Subject: #36061 [Opn->Bgs]: Escape {$var} not working
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969373983@lists.php.net to get a copy of this message
ID: 36061 Updated by: colder@php.net Reported By: dahlgren dot andreas at gmail dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: Windows 2003 Server PHP Version: 5.1.2 New Comment: The {$var} syntax is still available. So yes, { } are in a way still "special". To have '{hello}' printed you now need to use "{\$var}" and not "\{$var}" anymore. Being able to use "\{$var}" to print '{hello}' was an inconsistency that now is fixed. No documentation bug here. Previous Comments: ------------------------------------------------------------------------ [2006-01-18 11:14:34] dahlgren dot andreas at gmail dot com "This is expected behaviour, {} is no longer special, they are being treated like any other character." Ok if the above is true then bothe these statements should display the same thing? echo "{".$var."}"; echo "{$var}"; but the first one is "{hello}" and the otherone is "hello". ------------------------------------------------------------------------ [2006-01-18 00:15:34] judas dot iscariote at gmail dot com I reported this "problem" few weeks ago. and it's not a bug according to PHP Developers. it just changed the behaviour. :-( http://bugs.php.net/bug.php?id=35527 now the change is documented here: http://cl2.php.net/manual/en/language.types.string.php ------------------------------------------------------------------------ [2006-01-18 00:01:51] dahlgren dot andreas at gmail dot com Description: ------------ \{$var} results in wrong output. Reproduce code: --------------- <? $var = "hello"; echo "\{$var}"; ?> Expected result: ---------------- {hello} Actual result: -------------- \{hello} ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36061&edit=1

« previous php.doc (#969373983) next »