1 / 3

To combine Logical Statement: || is OR Eg : name is david or john

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…

drea
Download Presentation

To combine Logical Statement: || is OR Eg : name is david or john

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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)

  2. 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)

  3. 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; } ?>

More Related