Oihana PHP

isLeapYear.php

Table of Contents

Functions

isLeapYear()  : bool
Tells whether a year is a leap year, in the proleptic Gregorian calendar.

Functions

isLeapYear()

Tells whether a year is a leap year, in the proleptic Gregorian calendar.

isLeapYear(int $year) : bool

Pure arithmetic — divisible by 4, except centuries, which must be divisible by 400 — defined for any integer year, including zero and negative ones.

Parameters
$year : int

Any integer year.

Tags
example
use function oihana\core\date\isLeapYear;

isLeapYear( 2024 ) ; // true  (divisible by 4)
isLeapYear( 2026 ) ; // false
isLeapYear( 1900 ) ; // false (divisible by 100, not 400)
isLeapYear( 2000 ) ; // true  (divisible by 400)
author

Marc Alcaraz (ekameleon)

since
1.2.0
Return values
bool

true if $year is a leap year, false otherwise.

On this page

Search results