While the city slept, mr_burns (bissatch@yahoo .co.uk) feverishly typed...
[color=blue]
> I am tryin to format a number from, for example, 1 to '01'. How is
> this done? Cheers[/color]
printf("<p>num with 2 digits (leading zero): %02d</p>", $num);
This is the personal website of Nigel Moss - Web and software developer, musician, photographer. It is home to my CV, portfolio, general info and more.
Mail address not valid. nigel@DOG.nigen et.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
mr_burns wrote:
[color=blue]
> Hi,
>
> I am tryin to format a number from, for example, 1 to '01'. How is this done? Cheers
>
> Burnsy[/color]
From the PHP docs:
" kennyc at horizondigital dot com
14-Jun-2002 07:57
ONELINE LEADING ZERO ADDER: I kept getting frustrated by php's weak number
formatting functions and using the recursive leading zero adders that I've seen
in other people code, so here's my quick and easy oneliner for adding leading
zero's to any number:
Two digit space:
substr($num+100 ,1);
0=00
5=05
23=23
3.14=03.14
.oO(Michael Austin)
[color=blue]
> From the PHP docs:
>
>" kennyc at horizondigital dot com
>14-Jun-2002 07:57
>ONELINE LEADING ZERO ADDER: [...][/color]
Comment