Re: PHP 4.0 Bug #4432: parse error

From: Date: Fri, 12 May 2000 23:38:00 +0000
Subject: Re: PHP 4.0 Bug #4432: parse error
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-18665@lists.php.net to get a copy of this message
PHP 4.0 parses "{$var_expr}" as $var_expr (e.g., {$foo["bar"]}), to allow full variable reference, including multiple dimension arrays and objects, inside quoted strings. If you write {$var, $var}, PHP 4.0 will barf because it doesn't expect a , inside the variable expression. Thus, you need to escape it: \{$var, $var} Zeev On 12 May 2000 apostolicteacher@yahoo.com wrote: > From: apostolicteacher@yahoo.com > Operating system: RedHat 6.2 > PHP version: 4.0 Release Candidate 2 > PHP Bug Type: Scripting Engine problem > Bug description: parse error > > This works: fwrite($fp, "RatAlias add Personal $row[alias] {%s, %s} $row[item] > {}\n",$row[lname],$row[fname]); > > This works: fwrite($fp, "RatAlias add Personal $row[alias] {%s, %s} $row[item] > {}\n",$row[lname],$row[fname]); > > This does not: fwrite($fp, "RatAlias add Personal $row[alias] {$row[lname], $row[fname]} > $row[item] {}\n"); > > Notice the parameter replacement when using {%s, %s} works but {$row[lname], $row[fname]} does > not. The error is "expected } at line ..." > > > -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.dev (#18665) next »