- range: documentation ( source)
- printf: documentation ( source)
<?php
function abominable_is_leap_year($year) {
if ($year % 4 == 0)
goto verify;
goto no;
verify:
if ($year % 100 != 0)
goto yes;
if ($year % 400 == 0)
goto yes;
no:
return false;
yes:
return true;
}
foreach (range(0, 2020) as $year)
printf("%d: %s\n",
$year,
abominable_is_leap_year($year) ? "yes" : "no");
?>