(newbie) zero fill in variables
newbie here. i need to loop that'll give me values 0000-9999 in a variable. how do i go about?
i tried:
for ($count=0; $count<9999; $count++)
{
$var="string".$count;
// add $var to database
}
but that gave me values "string0", "string1", "string2" and so on. i need "string0000", "string0001", "string0002" and so on. these values are to be uploaded on a database, that's why i need the padding...
i tried:
for ($count=0; $count<9999; $count++)
{
$var="string".$count;
// add $var to database
}
but that gave me values "string0", "string1", "string2" and so on. i need "string0000", "string0001", "string0002" and so on. these values are to be uploaded on a database, that's why i need the padding...
