rounding a number 1.232344432 to 1.23

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
mccommunity
Forum Commoner
Posts: 62
Joined: Mon Oct 07, 2002 8:55 am

rounding a number 1.232344432 to 1.23

Post by mccommunity »

round a number 1.232344432 to 1.23 I thought float would do it but it still displays 1.232344432. I would like to just display 1.23. Not sure how?

Thanks
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

float round ( float val [, int precision])
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

Code: Select all

round(1.232344432, 2)
[php_man]round[/php_man]
Post Reply