选择框中始终缺少2月份

here is my sample code to display a select box. But the Month of Feb is always missing from the options list.

being new to PHP, will also appricate to suggest how may I i improve this code.

$birth_month = strtotime("-{$age} Years");
$birthday = strftime("%m.%Y", $birthday_timestamp);

for ($month_itr = 1; $month_itr <= $bis; month_itr++) {
   $option_value = strftime("%m.%Y", $birth_month );
   $option_text = strftime("%b. %y", $birth_month );
   $selected = ($birthday == $option_value ? 'selected="selected"' : '');
   echo "<option value='{$option_value}' {$selected}>{$option_text}</option>
";
   $birth_month = strtotime("+1 Month", $birth_month);
}
$birth_month = strtotime("-{$age} Years");

This line is calculating a date relative to today. As today is the 30th, the date will be the 30th of the relevant month. Given that you are scrolling through the months using "+1 Month" from this date you will always be looking at the 30th of each month. As 30th Feb doesn't exist, PHP calculates this as 2nd March (i.e. 2 days after 28th Feb). If you use something like

$birth_month = strtotime("-{$age} Years");
$birth_month = mktime( 0, 0, 0, date( 'm', $birth_month ), 1, date( 'Y', $birth_month ) );

You should be OK.

The problem is that you're running this code now, and February does not have 30 days (which is todays day). If you we're to run it tomorrow, you'd have only months with 31 days. The faulting line is:

$birth_month = strtotime("-{$age} Years");

Which will use the current timestamp if none other is given and subtract $age years, but the rest of the date is intact, so you'll end up with '2010-11-30' if $age is 1.