Re: Rounding issue

From: Date: Tue, 29 Jul 2003 22:21:51 +0000
Subject: Re: Rounding issue
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157459@lists.php.net to get a copy of this message
ahhh ok thanks guys!! That worked ... I knew it was something but I could not remember which function... thanks again! "Curt Zirzow" <curt@zirzow.dyndns.org> wrote in message news:20030729220848.GM10509@bagend.shire... > * Thus wrote Kevin Ison (kevin@kevison.com): > > I need to know if there is a work around for the following scenerio... > > > > $x = 4.5012412; > > echo round($x, 2); // results in 4.5 --- however I want 4.50! I want 2 > > decimal places! > > > > > > > > Is there a way to keep the zero from being dropped? I have not been able to > > get the zero to stay there ... I realize this is the interpreters problem > > but I need the zero. > > number_format(round($x, 2),2); > > you can always control with printf functions, but number format is > designed specifically for that. > > > Curt > -- > "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#157459) next »