Bug #8741 Updated: preg functions interpret { as part of variable interpolation

From: Date: Sat, 21 Jul 2001 08:32:07 +0000
Subject: Bug #8741 Updated: preg functions interpret { as part of variable interpolation
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-60467@lists.php.net to get a copy of this message
ID: 8741 Updated by: cynic Reported By: danbeck@dealnews.com Old Status: Closed Status: Bogus Bug Type: PCRE related Operating System: Linux 2.x, Redhat 6.2 PHP Version: 4.0.3pl1 Previous Comments: ------------------------------------------------------------------------ [2001-01-16 12:56:19] danbeck@dealnews.com 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 this bug report at http://bugs.php.net/?id=8741&edit=1

« previous php.dev (#60467) next »