What are some best practices for determining if a year is a leap year in PHP?

To determine if a year is a leap year in PHP, you can use the following logic: a year is a leap year if it is divisible by 4, unless it is divisible by 100 but not by 400. This means that a year like 2000 is a leap year because it is divisible by 400, while a year like 1900 is not a leap year because it is divisible by 100 but not by 400.

function isLeapYear($year) {
    return (($year % 4 == 0) && ($year % 100 != 0)) || ($year % 400 == 0);
}

// Usage
$year = 2000;
if(isLeapYear($year)) {
    echo $year . " is a leap year.";
} else {
    echo $year . " is not a leap year.";
}