Detect leap year

6 Years ago PHP(Functions) 0(Disable)

Detect leap year for gregorian and shamsi date.

function gLeapYear($year)
    if (($year % 4 == 0) and (($year % 100 != 0) or ($year % 400 == 0)))
        return true;
        return false;
function sLeapYear($year)
    $ary = array(1, 5, 9, 13, 17, 22, 26, 30);
    $b = $year % 33;
    if (in_array($b, $ary))
        return true;
    return false;
echo sLeapYear(1392).' ';
echo gLeapYear(2013);


No tag here.

Recommended pages

Encrypt and Decrypt function with different outputs...

Encrypt function return different value with each execute but decrypt function return input value. for example: first execute: encrypt('hello') => 'axxdfg34', decrypt('axxdfg34') return 'hello'...

alphaID - Translates a number to a short alhanumeric version...

Translates a number to a short alhanumeric version. e.g.: 9007199254740989 --> PpQXn7COf In most cases this is better than totally random ID generators because this can easily avoid duplicate ID's. Fo...

PHP subwords() Function...

Function subwords, gets words by max num....

Detect file extension function...

This function is used to find the file extension also you can use pathinfo() function for get information about a file path. function ext($file_name) { return substr($file_name, strrpos($fi...