php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2917 parenthesis inside " " product a parser error
Submitted: 1999-12-05 06:41 UTC Modified: 1999-12-09 13:37 UTC
From: carmelo at melting-soft dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 3 OS: Solaris 2.5.1
Private report: No CVE-ID: None
 [1999-12-05 06:41 UTC] carmelo at melting-soft dot com
the following script should drop a parser error :
(works on php3 and not on pp4)
$showvar=1;
if (1) {
$thevar="{$showvar}";
};

the following script works :
(work on php4 and php3)
$showvar=1;
if (1) {
$thevar='{'.$showvar.'}';
};

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-09 13:37 UTC] zeev at cvs dot php dot net
Curly braces have a new meaning in PHP 4.0, they allow you
to reference a 'full featured' variable within quoted strings, e.g.:

print "{$foo["bar"][2*3]}";

If you want to have the two letters {$ inside a quoted string, you must then escape either the { using \:

print "\{$foo}";


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 18:01:34 2024 UTC