Return to Snippet

Revision: 49338
at July 20, 2011 07:44 by BilalELMoussaoui


Initial Code
function is_leap($year){
    try {
        $year = intval(abs($year));
        if(is_numeric($year)){
            if(($year % 4) === 0){
                return true;
            }
            return false;
        }else{
            throw new Exception('is_leap() exepts one param as numeric given ,'.gettype($year));
        }
    }catch(Exception $e){
        trigger_error($e->getMessage(),E_USER_ERROR);
    }    
}

Initial URL


Initial Description
check if the year is leap

Initial Title
check if the year is leap

Initial Tags
php

Initial Language
PHP