homepage Welcome to WebmasterWorld Guest from 54.196.162.238
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
formatting number such as 000001
camilord




msg:3658127
 1:51 pm on May 24, 2008 (gmt 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..

 

camilord




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

got it..

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

?>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved