php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36061 Escape {$var} not working
Submitted: 2006-01-18 00:01 UTC Modified: 2006-09-08 17:24 UTC
From: dahlgren dot andreas at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.1.2 OS: Windows 2003 Server
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dahlgren dot andreas at gmail dot com
New email:
PHP Version: OS:

 

 [2006-01-18 00:01 UTC] 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}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-18 00:15 UTC] 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 11:14 UTC] 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-09-08 17:24 UTC] colder@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 04:01:35 2025 UTC