jwk811 Posted January 14, 2007 Share Posted January 14, 2007 how can i round a number to the nearest 10? round function wouldnt work because it rounds only to the nearest integer... Quote Link to comment Share on other sites More sharing options...
Hypnos Posted January 14, 2007 Share Posted January 14, 2007 I'm pretty sure this should do it:[code=php:0]$rounded = round($x, -1);[/code] Quote Link to comment Share on other sites More sharing options...
Barand Posted January 14, 2007 Share Posted January 14, 2007 to round to nearest N[code]<?php$N = 10;$x = 14;echo round($x/$N) * $N;?>[/code] Quote Link to comment Share on other sites More sharing options...
jwk811 Posted January 14, 2007 Author Share Posted January 14, 2007 also how could i round a number so it goes up to the nearest integer.. i dont want it to round down ever always up and round doesnt do that.. i actually need the 10 rounded up to.. how could i do that Barand? Quote Link to comment Share on other sites More sharing options...
Barand Posted January 14, 2007 Share Posted January 14, 2007 ceil() 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.