www.php.net/sprintf

codice:
$number = 1;
$new = sprintf("%03d", $number);