Detect leap year

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;
    else
        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);

Tags

No tag here.

Recommended pages

Resize image function...

Resize image function for jpg format. $mood between max and min. if you choose max, this mean max size of image is $ta otherwise min size of image is $ta. function makeTheThumb( $ppath, $ta, $mood ) ...

Gregorian to Persian Date Convertor...

Gregorian to Persian Date Convertor....

Extract numbers from a unicode string...

Quick extract numbers from a unicode string......

Delete file function...

If file exists then delete the file. function delFile( $file_name ) { if ( file_exists( $file_name ) ) // Does '$file_name' exist { unlink( $file_name ); return true; } ...