夕食の精度を高めるには、うるう年の要因を考慮する必要があります。
function get_age($dob_day,$dob_month,$dob_year){
$year = gmdate('Y');
$month = gmdate('m');
$day = gmdate('d');
//seconds in a day = 86400
$days_in_between = (mktime(0,0,0,$month,$day,$year) - mktime(0,0,0,$dob_month,$dob_day,$dob_year))/86400;
$age_float = $days_in_between / 365.242199; // Account for leap year
$age = (int)($age_float); // Remove decimal places without rounding up once number is + .5
return $age;
}
だから使用:
echo get_date(31,01,1985);
または何でも...
NBあなたの正確な年齢を小数まで見るには
return $age_float
代わりは。