socalnate Posted May 7, 2007 Share Posted May 7, 2007 Here's what I need my script to do; quite simple but I can't figure it out. ??? If $number is 0-999 number is "0" If $number is 1000-1999 number is "1000" If $number is 2000-2999 number is "2000" If $number is 3000-3999 number is "3000" etc...(going on up to 10,000) If $number is 10000-10999 number is "10,000" If $number is 11,000-11,999 number is "11,000" etc...(going on up to 100,000) If $number is 100,000-100,999 number is "100,000" If $number is 101,000-101,999 number is "101,000" If $number is 123,000-123,999 number is "123,000" etc...(going on up & beyond 300,000) If $number is 357,000-357,999 number is "357,000" Help appreciated! Nathan Quote Link to comment https://forums.phpfreaks.com/topic/50408-solved-mathematical-script-question/ Share on other sites More sharing options...
sasa Posted May 7, 2007 Share Posted May 7, 2007 try <?php $a=12345; $a -= $a % 1000; echo $a; ?> Quote Link to comment https://forums.phpfreaks.com/topic/50408-solved-mathematical-script-question/#findComment-247587 Share on other sites More sharing options...
Barand Posted May 7, 2007 Share Posted May 7, 2007 <?php $number = 12345; echo round($number-500, -3); //--> 12000 ?> Quote Link to comment https://forums.phpfreaks.com/topic/50408-solved-mathematical-script-question/#findComment-247605 Share on other sites More sharing options...
socalnate Posted May 9, 2007 Author Share Posted May 9, 2007 Sasa your script worked perfectly and well! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/50408-solved-mathematical-script-question/#findComment-248646 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.