[SOLVED] decimal point to 2...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

decimal point to 2...

Post by kevin7 »

how to make a value... for example 130.328... to be rounded to 130.33..
tq...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]round[/php_man]($num, 2);
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Post by kevin7 »

hmm.... yes... it work...
if i wanna to display 128.8 to 128.80?

really appreaciated!
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

if you'd need it for display only, have a look at [php_man]sprintf[/php_man]
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Post by kevin7 »

ooo... that was C programming~~~

i neva thought it was such useful in PHP too...!

tq anyway~ :lol:
Post Reply