분류
php
PHP : 나이 계산
본문
- <?php
- /*
- Calculate Age
- With this function you can calculate the age of a person
- Example:
- echo "Age is: " . birthday ("1984-07-05");
- Result will be (23 Feb 2005) = "Age is: 20"
- calculate years of age (input string: YYYY-MM-DD)
- */
- function birthday ($birthday)
- {
- if ($month_diff < 0) $year_diff--;
- elseif (($month_diff==0) && ($day_diff < 0)) $year_diff--;
- return $year_diff;
- }
- ?>
- 이전글PHP : Facebook Style time ago 18.08.31
- 다음글MySQL 가이드 유튜브강좌 18.08.31