Re: [PHP] Rounding issue

This is a discussion on Re: [PHP] Rounding issue within the PHP General forums, part of the PHP Programming Forums category; > $x = 4.5012412; > echo round($x, 2); // results in 4.5 --- however I want 4.50! I > ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-29-2003
Larry E . Ullman
 
Posts: n/a
Default Re: [PHP] Rounding issue

> $x = 4.5012412;
> echo round($x, 2); // results in 4.5 --- however I want 4.50! I
> want 2
> decimal places!


echo number_format ( round ($x, 2), 2);

Larry

Reply With Quote
  #2 (permalink)  
Old 07-29-2003
Kevin Ison
 
Posts: n/a
Default Re: [PHP] Rounding issue

ahhh ok thanks guys!! That worked ... I knew it was something but I could
not remember which function...

thanks again!

"Larry E . Ullman" <LarryUllman@DMCInsights.Com> wrote in message
news:B16057B0-C210-11D7-A9D4-000393641AFC@DMCInsights.Com...
> > $x = 4.5012412;
> > echo round($x, 2); // results in 4.5 --- however I want 4.50! I
> > want 2
> > decimal places!

>
> echo number_format ( round ($x, 2), 2);
>
> Larry
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:50 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0