Call us Toll-Free:
Email us


Strip last numeral to 0

Code Wizard, 12-30-2006

This script strips the last numeral in any given number and acts as if it's "rounding" the number off, when in actuality, it's only replacing the last numeral with a "0"

Script was written and can be seen in action on where it says " of over 100 designers...".


// By: Andrew Heebner
// Written For Web Design Masters

$fullnum = (strlen($num)-1);
$getnums = substr($num,0,$fullnum);
$output = $getnums."0";
print $output;

Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

Post your comments

Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.

About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions