RE: [PHP] pad numbers
| From: | Susan Ator | Date: | Fri, 10 Oct 2003 14:47:12 +0000 |
| Subject: | RE: [PHP] pad numbers | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-165748@lists.php.net to get a copy of this message | ||
The way I have done it is to check the length of the number and if it is 1
then add the 0 myself.
my $len = length($mm);
if ($len eq 1) { $mm = "0$mm"; }
Susan
-----Original Message-----
From: Diana Castillo [mailto:diana@interhotel.com]
Sent: Friday, October 10, 2003 10:45 AM
To: php-general@lists.php.net
Subject: [PHP] pad numbers
is there a function to convert a number that has less than two digits into a
number with a leading zero?
for instance, to convert a "5" to "05" but to leave a "11" as
"11"
thanks,
Diana
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php