Re: pad numbers
| From: | Tom Rogers | Date: | Fri, 10 Oct 2003 14:50:15 +0000 |
| Subject: | Re: pad numbers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165749@lists.php.net to get a copy of this message | ||
Hi,
Saturday, October 11, 2003, 12:44:38 AM, you wrote:
DC> is there a function to convert a number that has less than two digits into a
DC> number with a leading zero?
DC> for instance, to convert a "5" to "05" but to leave a "11" as
DC> "11"
DC> thanks,
DC> Diana
$num = sprintf("%02d",$num); is what you need
--
regards,
Tom