- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
class ZDate extends Logic
{
/**
* return age
*
* @param integer $birthday
* @return string
*/
public static function getAge($birthday)
{
$year = date('Y', $birthday);
$month = date('m', $birthday);
$day = date('d', $birthday);
$cur_year = date('Y');
$cur_month = date('m');
$cur_day = date('d');
$age = $cur_year - $year;
if ($cur_month < $month) --$age;
if ($cur_month == $month && $cur_day < $day) --$age;
return (string) $age;
}
}
Follow us!