[thelist] [PHP] Add a leading zero to a single digit integer

Tim Burgan email at timburgan.com
Wed Nov 24 21:33:01 CST 2004

Tim Burgan wrote:

> How can I add a leading zero to an integer IF its length it one digit? 

My apologies .. I've found my own answer.

For anyone else's reference, I found the answer under 'Integers' [1] in 
the PHP Manual.

   substr( $numb + 100, 1 );

[1] <http://php.planetmirror.com/manual/en/language.types.integer.php>



Tim Burgan.
Website Development & Graphic Design

E <email at timburgan.com>
W <www.timburgan.com>

More information about the thelist mailing list