Re: PHP 4.0 Bug #8741: preg functions interpret { as part of variable interpolation

From: Date: Tue, 16 Jan 2001 18:26:37 +0000
Subject: Re: PHP 4.0 Bug #8741: preg functions interpret { as part of variable interpolation
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-44258@lists.php.net to get a copy of this message
I would, but I only want to remove the decimals if they are 0. I want to see actual decimal values that exist. Daniel ----- Original Message ----- From: "Derick Rethans" <derick@jdimedia.nl> To: <danbeck@dealnews.com> Cc: <php-dev@lists.php.net> Sent: Tuesday, January 16, 2001 12:19 PM Subject: Re: [PHP-DEV] PHP 4.0 Bug #8741: preg functions interpret { as part of variable interpolation > On 16 Jan 2001 danbeck@dealnews.com wrote: > > > 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 > > I know it has nothing to do with the bug, but why don't you just use this: > echo floor ($number); > > Derick Rethans > > --------------------------------------------------------------------- > PHP: Scripting the Web - www.php.net - derick@php.net > --------------------------------------------------------------------- > > >

« previous php.dev (#44258) next »