Hi,
You can achieve this by using the printf or sprintf statements.
<?
$numberval = 1;
printf("My number = %02d", $numberval);
?>
This will print "01"
If numberval = 20 - it will only print "20".
The %02d is the key. %02 means - print 2 characters with leading zero's if
there aren't 2 characters.
%03 - 3 characters with leading zero's etc etc
Hope I've explained that ok.
Sam
Phillip S. Baker <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED].;
> Hey All,
>
> I want PHP to print out the value of a number in a variable as something
> like 01.
> However whenever I try to I only get 1.
>
> Is there a way around this?
>
> Phillip
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php