fredboniface.co.uk/php/age.php

12 lines
237 B
PHP
Raw Normal View History

2022-10-07 11:14:36 +01:00
<?php
function getAge($birth_year, $birth_month) {
$cur_year = date("Y");
$cur_month = date("m");
if ($birth_month > $cur_month) {
return (($cur_year - 1) - $birth_year);
} else {
return ($cur_year - $birth_year);
}
}