Mega Code Archive

 
Categories / Php / Functions
 

User-Defined Function to Determine a Leap Year

<?php     function is_leapyear($year = 2004) {         $is_leap = (!($year % 4) && (($year % 100) || !($year % 400)));         return $is_leap;     }     $answer = is_leapyear(2000);     if($answer) {         echo "2000 is a leap year<BR>";     } else {         echo "2000 is not a leap year.<BR>";     }     $answer = is_leapyear();      if($answer) {         echo "2003 is a leap year.<BR>";     } else {         echo "2003 is not a leap year.<BR>";     } ?>