note 92447 deleted from function.date by tularis
| From: | tularis@php.net | Date: | Thu, 09 Feb 2012 20:56:56 +0000 |
| Subject: | note 92447 deleted from function.date by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185986@lists.php.net to get a copy of this message | ||
Note Submitter: seanj
----
An earlier user posted a script to detect whether or not a given year is a leap year:
<?php
function is_leapyear($year = 2004) {
$is_leap = date('L', strtotime("$year-1-1"));
return $is_leap;
}
?>
You're thinking too hard! Just check to see if the year is a multiple of four:
<?php
function is_leapyear($year = 2004) {
return ($year%4)==0;
}
?>
or better yet, just use that single line in your code.