how can I limited a number to 2 decimal places like
2.34
or have 2.346 be 2.35
limiting a number to 2 decimal places
Moderator: General Moderators
-
psychotomus
- Forum Contributor
- Posts: 487
- Joined: Fri Jul 11, 2003 1:59 am
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
take a look at the round() function
for more functions dealing with this see ceil() floor() number_format()
Code: Select all
$number = 5.73458565;
$twodecimals = round($number,2);