Output number with leading zeros

Here's simple example using the printf function to output a number with leading zeros.

<?
$number = 15;
printf("%05d", $number);
?>

You might also like...

Comments

 Alt-PHP-Faq

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Before software should be reusable, it should be usable.” - Ralph Johnson