ID: 8741
Updated by: andrei
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: PCRE related
Assigned To: 
Comments:

The {$var} construct is interpreted specially in the double-quoted strings by the Zend 
engine - it will interpolate the variable so you indeed need to escape it with a 
backslash. This is not a PCRE problem.

Previous Comments:
---------------------------------------------------------------------------

[2001-01-16 12:56:19] [EMAIL PROTECTED]
The following code does not work properly

$number = "999.00";
$precision = 2;
echo preg_replace("/.0{$precision}/", "", $number);

it echos 999.00

But if you escape the first `{' bracket, the regular expression works properly

echo preg_replace("/.0{$precision}/", "", $number);

it echos 999





---------------------------------------------------------------------------


Full Bug description available at: http://bugs.php.net/?id=8741


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to