Leap Year

A leap year is a calendar year in which an extra day is added to make the calendar year synchronized with an astronomical or seasonal year.

Note – February has 29 days in every Leap Year. And the rest of the year has 28 days.

Example of Leap Year-

2004 – is a Leap Year
2005 – is not a Leap Year
2006 – is a Leap Year
2007 – is not a Leap Year
2008 – is a Leap Year

PHP Example –

<?php
    $year = 2008;
    // conditions to check the leap year  
    if (($year % 4 == 0) and ($year % 100 !=0) or ($year % 400 ==0)) {
        echo "$year is a Leap Year";
    } else {
        echo "$year is not a Leap Year";
    }
?>

Output

2008 is a Leap Year