Thursday, November 16, 2017

Save form data into Local Storage and then get back using plain javascript (No JQuery)

Friday, November 10, 2017

How to get a given year is a leap year using PHP or Excel/Spreadsheet

Year 1600 was leap year but not 1700.
How to solve this output using php (solution for excel/Spreadsheet is in bottom of the page).

Here is the code.

<?php
$year = 2020;
$dBy4 = gmp_div_r($year, 4);
$answer = 'Not a Leap year';
if($dBy4 == 0) {
    $dBy100 = gmp_div_r($year, 100);
    $dBy400 = gmp_div_r($year, 400);
    if($dBy100 == 0 && $dBy400 == 0) {
        $answer = $year.' is a leap year';
    }
}
// $dBy4 = gmp_div_r($year, 4);
echo $answer;

?>

Try out this Fiddle 

Also here is the solution for EXCEL 
Download excel/ spreadsheet