生日前的最后一天[关闭]

I search a function for calcul the last day before a birthday.

function daysLeftForBirthday($devabirthdate)
{
    /* input birthday date format -> Y-m-d */
    list($y, $m, $d) = explode('-',$devabirthdate);
    $nowdate = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $nextbirthday = mktime(0,0,0,$m, $d, date("Y"));

    if ($nextbirthday<$nowdate)
        $nextbirthday=$nextbirthday+(60*60*24*365);

    $daycount=intval(($nextbirthday-$nowdate)/(60*60*24));

    return $daycount;
} 
$timestamp = strtotime("yesterday", $birthday);

the $birthday must be a timestamp,if the $birthday is a string like "1992-09-98",you must change it like this

$birthday = strtotime($birthday);