Ok, here is what I am trying:
for($i = 1; $i <= 100; $i++) {
$var .= dechex($i);
}
print $var;
what it outputs is correct but I want is
00 instead of 0
01 instead of 1
....
and so forth how can I force the extra digit?
Thanks
two digits?
Moderator: General Moderators
Code: Select all
str_pad($var,2,"0",STR_PAD_LEFT);Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
printf("%02d",$value);Code: Select all
sprintf("%02d",$value);