30 likes | 175 Views
To combine Logical Statement: || is OR Eg : name is david or john If ($name==‘ david ’ or $name==‘john’) && is AND Eg : boy and over 18 years old If ($gender==“boy” and $age>18). Divisible By 4. Divisible By 100. Divisible By 400. LEAP year only if in shaded region…
E N D
To combine Logical Statement: || is OR Eg: name is david or john If ($name==‘david’ or $name==‘john’) && is AND Eg: boy and over 18 years old If ($gender==“boy” and $age>18)
Divisible By 4 Divisible By 100 Divisible By 400 • LEAP year only if in shaded region… • Divisible by 400 (year %400==0) • OR • (Not divisible by 100 and Divisible by 4) • (year%100>0 && year%4==0) • Final: • Divisible by 4: • If (year %4==0) • Divisible by 100 • If (year %100==0) • Divisible by400 • If (year %400==0)
Print last 227 leap year <?php $i=1; $year=2012; while ($i<=226){ if (($year%400==0 )|| ($year%4==0 ) && !($year%100==0 && $year%400!=0)) { echo $i."->".$year; echo "<br/>"; $i++; } $year=$year-4; } ?>