how do i take a number in php and pad it out with 0s? like, 1 becomes 0001,
thanks
function leading_zero($length,$number){ $length=$length-strlen($number); for ($i = 0; $i < $length; $i++){ $number = "0" . $number; } return($number); } "leading_zero(3,15)" returns "015"
This answer is courtesy of the manual
very nice, thanks
or use str_pad(): http://www.php.net/manual/en/function.str-pad.php