Re: [PHP-DEV] PHP 4.0 Bug #4432: parse error From: Zeev Suraski (zeev <email protected>)
Date: 05/12/00

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 <email protected> wrote:

> From: apostolicteacher <email protected>
> 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 <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>