How to Round to the Nearest Multiple of 50?

From: Date: Thu, 14 Sep 2000 05:10:27 +0000
Subject: How to Round to the Nearest Multiple of 50?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16708@lists.php.net to get a copy of this message
Hello All, I have an integer variable - lets call it $scaleHeight - somewhere between 0 and 1200. In all likelihood this variable will not be a multiple of 50. It will be 49 or 51 or 1143 or 856 ... How do I round $scaleHeight to the Nearest Multiple of 50? The reason I wish to do this is to obtain a variable which I can then use in a switch statement, which is clearer to code and faster to run than a whole lot of if statements. Anyone know the answer? Regards, Richard Creech richardc@dreamriver.com Phone: 250.744.3350 Pacific Time Canada Download phpYellow Pages 2000 - BETA Add Dynamic Database Content to your Website http://www.dreamriver.com/software/

« previous php.general (#16708) next »