Welcome to WebmasterWorld Guest from 54.147.44.13

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

formatting number such as 000001

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

Junior Member

5+ Year Member

joined:Apr 20, 2006
posts:109
votes: 0


<?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..

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

Junior Member

5+ Year Member

joined:Apr 20, 2006
posts:109
votes: 0


got it..

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

?>