Forum Moderators: coopster

Message Too Old, No Replies

formatting number such as 000001

         

camilord

1:51 pm on May 24, 2008 (gmt 0)

10+ Year Member



<?php

for ($i = 0; $i < 100; $i++)
{

echo $i.'<br>';
}

?>

instead of

1
2
3
4
5
...

i want the result of

0000001
0000002
0000003
0000004
...

can anybody help?

advance thanks..

camilord

2:08 pm on May 24, 2008 (gmt 0)

10+ Year Member



got it..

<?php
$x = 122;
$y = sprintf("%06d",$x);
echo $y;

?>