quillspirit Posted October 16, 2006 Share Posted October 16, 2006 I know I can round to a whole number with [code]ceil[/code] - but how can I round the just the hundredth? (Second number)...Like 1.33333333333333to1.33?Thanks for the help :) Quote Link to comment Share on other sites More sharing options...
cows Posted October 16, 2006 Share Posted October 16, 2006 I think..[code]round("1.33333333333333", 2);[/code] Quote Link to comment Share on other sites More sharing options...
quillspirit Posted October 16, 2006 Author Share Posted October 16, 2006 *EDIT*Thanks, that did the trick :) Quote Link to comment Share on other sites More sharing options...
xsist10 Posted October 16, 2006 Share Posted October 16, 2006 Just remember:[code]<?php// ceil rounds upecho ceil("1.00001");// will print out 2// floor rounds downecho ceil("1.99999");// will print out 1?>[/code] Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 16, 2006 Share Posted October 16, 2006 Heres a nice little example for you.[code]<?php$computer_price=ceil("1.9999");$computer_price=sprintf("\$%01.3f",$computer_price);echo " Please Pay $computer_price for your pc"; ?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.