--- Pandora <[EMAIL PROTECTED]> wrote:
> For anyone who is interested I found the answer to my problem by using:
>
> str_pad($x, 2, "0", STR_PAD_LEFT);
>
> There is also:
>
> Printf("%02d", $x)
>
> I'm not sure if my original message got through as I don't see it in the
> group at the moment.
>
> Janet
I was going to read the rest of my emails to see if you received a reply
already. Someone must have defined a law that the moment you compose a
question and send it out, the answer will arrive on its own in about the time
it takes to ask it. :)
Your printf() example is good and along the lines I had in mind. The str_pad()
may not cover all inputs. You can place the value in a variable with sprintf()
$padded_value = sprintf("%02d", $input_value);
There are probably three or four other ways to solve this, as with any simple
programming problem. I find the sprintf() to be the most readable without
consulting a function documentation in print or on the Internet.
James