Check Leap Year Script

Check Leap Year Script is use to check if a particular year is a leap year.

Demo :



Select Year :  

Example :

Select Year : 2020

Code :

If you need to Check Leap Year Script code you will copy and use to your website.

<?php
function testLeapYear($year)
{
   $ret = (($year%400 == 0) || ($year%4 == 0 && $year%100 != 0)) ? true : false;
   return $ret;
}
echo testLeapYear(2020) ? "Is a leap year" : "Is not a leap year";
?>

A year is a leap year if it is fully divisible by 400, or by 4 but not 100. The function testLeapYear() in the previous listing encapsulates this logic, using PHP's % operator to check for divisibility, and returns a Boolean value indicating the result.

Free Download Script :

If you need Check Leap Year Script click and download from following link.

Download




Content