PHP Number Leading Zero’s

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

Author: insic

Subscribe in my RSS Feed for more updates on Web Design and Development related articles. Follow me on twitter or drop a message to my inbox.

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