PHP 4.0 Bug #8741: preg functions interpret { as part of variable interpolation
| From: | danbeck at dealnews dot com | Date: | Tue, 16 Jan 2001 17:56:19 +0000 |
| Subject: | PHP 4.0 Bug #8741: preg functions interpret { as part of variable interpolation | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44249@lists.php.net to get a copy of this message | ||
From: danbeck@dealnews.com
Operating system: Linux 2.x, Redhat 6.2
PHP version: 4.0.3pl1
PHP Bug Type: PCRE related
Bug description: preg functions interpret { as part of variable interpolation
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
--
Edit Bug report at: http://bugs.php.net/?id=8741&edit=1