달력

112024  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

function getManNai($birth_year,$birth_month,$brith_day){
        $birth_year = (int)$birth_year;
        $birth_month = (int)$birth_month;
        $brith_day = (int)$brith_day;

        $now_year = date("Y");
        $now_month = date("m");
        $now_day = date("d");

        if($birth_month < $now_month){
           $age = $now_year - $birth_year;
        }else if($birth_month == $now_month){
         if($brith_day <= $now_day)
          $age = $now_year - $birth_year;
         else
          $age = $now_year - $birth_year -1;
        }else{
           $age = $now_year - $birth_year-1;
        }
        return $age;
}
        
getManNai(1990,01,05);

Posted by 타카스 류지
|