How do I start a for-loop with 01 as opposed to 1? I’ve tried the below, but it doesn’t seem to work.
for ($i = 01; $i <= 12; $i++) {
echo "<option value='$i'";
if ($i == $post_response[expiremm]) {
echo " selected='selected'";
}
$month_text = date("F", mktime(0, 0, 0, $i+1, 0, 0, 0));
echo ">$month_text</option>";
}
You can’t really start an integer at 01, you will need to pad the value, probably using
str_padto prefix leading elements to a string:Note that for different unit types you will obviously need to alter the desired
pad_length.