Log 2371
20/12/2023 2023-12-20 10:46$currentDate = date(‘d/m/Y’);
$birthDate = #תאריך לידה#;
$currentDay = substr($currentDate, 0, 2);
$currentMonth = substr($currentDate, 3, 2);
$currentYear = substr($currentDate, 6);
$birthDay = substr($birthDate, 0, 2);
$birthMonth = substr($birthDate, 3, 2);
$birthYear = substr($birthDate, 6);
$totalMonths = (($currentYear – $birthYear) * 12) + ($currentMonth – $birthMonth);
if ($currentDay < $birthDay) {
$totalMonths–;
}
$totalYears = floor($totalMonths / 12);
$totalMonths %= 12;
return "Age: {$totalYears} years and {$totalMonths} months";