PHP Number Leading Zero’s

<?php
$id = 3;
echo sprintf("%04d",$id);
//result 0003
?>
PG

Author: admin

Random Post

Delicious

3 Responses to “PHP Number Leading Zero’s”

  1. are you drunk or something?
    check “retuslt”. :)

  2. anyway.

    str_pad() is another nice solution
    for this.

  3. hehehe my bad, im not drunk. thanks Ace

Leave a Reply