PHP round to closest 10, 100, 1000, 10000 etc
This is one way to round to closest 10, 100, 1000, 10000 etc.
<?php
$max_vid = 1234 ; //A number you want to round
$nbr = strlen($max_vid);
$nbr = pow(10, $nbr); // The exponent, same as in math 10^$nbr
echo $rounded = ceil($max_vid / $nbr) * $nbr;
//12 => 100
//123 => 1000
//1243 => 10000
//12345 => 100000
?>