Formatting A Number With Leading Zeros

function digit($nom, $digit){
        $num = sprintf("%0" . $digit ."s", $nom);
        return $num;

How to call

$string = $this->digit(50,5); //return 00050
Comment / Response

  • James
    Good blog! I really love how it is easy on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I have subscribed to your feed which must do the trick! Have a nice day!

Your Comment / Response