Is there a function that allows me to format a number with leading zeros?

ie. ensure a number is 8 digits:

3 == 00000003

300 == 00000300

300000 == 00300000

I can build my own function but I was wondering if there is a built in one.

Thanks

Greg

    You can also do it with sprintf() or printf() should that be useful to whatever you are trying to do.

    printf("%08d", $var);
    
      Write a Reply...