How to check if a year is a Leap year or not with a php script
A leap year ha 366 days instead of the usual 365, by extending February to 29 rather than the common 28.A leap year can be divided by 4,100 and mostly 400.
All this can also be presented in a php script which can be use to check if the year inputted by the user is a leap year or not. The following script shows you how to check if a year is a leap year or not..
<?phpecho date('L');
echo date('L', strtotime('last year'));
$year = 1997;$leap = date('L', mktime(0, 0, 0, 1, 1, $year));echo $year . ' ' . ($leap ? 'is' : 'is not') . ' a leap year.';?>
The php code above produce the following outpt.
Now we can check if a year is a leap year or not.
No comments:
Post a Comment