1
0
Fork 0
template/functions/age.php
2024-09-23 20:40:19 +02:00

13 lines
No EOL
343 B
PHP
Executable file

<?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;
}
}
?>