Last active
April 5, 2019 17:16
-
-
Save DaveyJake/b6f28c99f186e4bcd3ee76359746e21a to your computer and use it in GitHub Desktop.
Check For Leap Year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple function to check if it's currently a 'leap year'. | |
* | |
* @return bool True if it is. False if not. | |
*/ | |
function is_leap_year() { | |
// Ensure that '0' isn't read as boolean. | |
$zero = (int) 0; | |
// Current Year | |
$year = date( 'Y' ); | |
// No remainders means it's a leap year! | |
return ( $year % 4 === $zero ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment