View Single Post
Old 12-10-2007, 10:59 PM   #7 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by Haris View Post
php Code:
foreach(range(1, 200) as $iInteger)
{
    echo sprintf("%02d", $iInteger);
}
Regarding echo sprintf, what's that all about? Also, there is no need in this case for double quotes around the formatting string. I'm sure this isn't the first time I've seen echo sprintf posted up here, so every time I see it, I'll keep nagging!

php Code:
foreach (range(1, 200) as $iInteger)
{
    printf('%02d', $iInteger);
}

Last edited by Salathe : 12-11-2007 at 01:59 AM.
Salathe is offline  
Reply With Quote
The Following 2 Users Say Thank You to Salathe For This Useful Post:
Haris (12-11-2007), SOCK (12-11-2007)