1
0
Fork 0
template/functions/age.php

14 lines
344 B
PHP
Raw Normal View History

2024-04-25 22:00:49 +02:00
<?php
function age($year, $month, $day, $time = null) {
if(!is_numeric($year) OR !is_numeric($month) OR !is_numeric($day)) {
return 'XX';
} else {
$diff = date_diff(date_create($year.'-'.$month.'-'.$day . (empty($time) ? null : ' '.$time)), date_create(date('Y-m-d'.(empty($time) ? null : ' Hi'))));
return $diff->y;
}
}
?>