1
0
Fork 0
template/functions/age.php

13 lines
343 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;
}
}
2024-09-23 20:40:19 +02:00
?>