Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » PHP




 Page 1 of 1 [ 5 posts ] 



Author Message
 Post subject: Roundin
 Post Posted: Thu Nov 19, 2009 7:09 am 
Offline

Joined: Sat Feb 21, 2009 1:05 pm
Posts: 66
Hi,

Using da round function I m roundin number 2 two decimal places.
This works perfectly fine untill da unit is a 0.

So 4 example: 10.10 rounds 2 10.1

How could I ensure da unit remains if it s a 0.

Thanks in advance,

_________________
If your wife wants to learn to drive, don't stand in her way.


Top 
 Post subject: Re: Roundin
 Post Posted: Thu Nov 19, 2009 7:09 am 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
10.10 was exactly da same as 10.1, so roundin is not at all
changin da value. PHP removs superfluous trailin zeros. I would leave da
zero off for da purposes of doin math do it. When u need to display
it, use number_format()


Top 
 Post subject: Re: Roundin
 Post Posted: Thu Nov 19, 2009 7:09 am 
Offline

Joined: Sat Feb 21, 2009 1:05 pm
Posts: 66
Thanks - I m displyin a price so da trailin 0 was required in dis
case. da number_format function works perfectly.

_________________
If your wife wants to learn to drive, don't stand in her way.


Top 
 Post subject: Re: Roundin
 Post Posted: Thu Nov 19, 2009 7:09 am 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
If it' was a price, you could also use the money_format().


Top 
 Post subject: Re: Roundin
 Post Posted: Thu Nov 19, 2009 7:10 am 
Offline

Joined: Sat Feb 21, 2009 1:05 pm
Posts: 66
kkk

_________________
If your wife wants to learn to drive, don't stand in her way.


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 5 posts ] 




Board index » Server Side Development » PHP


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron