public static function isLeapYear($year)
    {
        if (preg_match('/\D/', $year)) {
            return false;
        }
        if ($year < 1000) {
            return false;
        }
        if ($year < 1582) {
            // pre Gregorio XIII - 1582
            return ($year % 4 == 0);
        } else {
            // post Gregorio XIII - 1582
            return (($year % 4 == 0) && ($year % 100 != 0)) || ($year % 400 == 0);
        }
    }
public static function isLeapYear($year)
    {
        if (preg_match('/\D/', $year)) {
            return false;
        }
        if ($year < 1000) {
            return false;
        }
        if ($year < 1582) {
            // pre Gregorio XIII - 1582
            return ($year % 4 == 0);
        } else {
            // post Gregorio XIII - 1582
            return (($year % 4 == 0) && ($year % 100 != 0)) || ($year % 400 == 0);
        }
    }
public static function isLeapYear ( $ year ) { if ( preg_match ( '/\D/' , $ year ) ) { return false ; } if ( $ year < 1000 ) { return false ; } if ( $ year < 1582 ) { // pre Gregorio XIII - 1582 return ( $ year % 4 == 0 ) ; } else { // post Gregorio XIII - 1582 return ( ( $ year % 4 == 0 ) && ( $ year % 100 != 0 ) ) || ( $ year % 400 == 0 ) ; } }
Returns true for a leap year, else false

@param int   $year   the year.  Use the complete year instead of the
abbreviated version.  E.g. use 2005, not 05.
Do not add leading 0's for years prior to 1000.
@return boolean
Returns true for a leap year else false