Calculators
|
|
|
|
<?php function get_age($date_of_birth) {
list ($year, $month, $day) = explode('-', $date_of_birth);
$age = date('Y') - $year;
if (date('m') < $month) $age--;
elseif (date('d') < $day) $age--;
return $age;
} ?>
|
|
|
Usage Example
|
$age = get_age('1981-03-29');
|
|
|
Rate This Script
|
|
|
|