HTMLify
If-else.php
Views: 602 | Author: djdj
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <?php $a = 5; $b = 2000; $c = 2016; if($a > 2){ echo "a is greater than 2\n"; } else{ echo "a is less than 2 OR not greater than 2\n"; } //even odd if($a % 2 == 0){ echo "a is even number\n"; } else{ echo "a is odd number\n"; } //positive, negetive and zero if($a > 0){ echo "a is positive integer\n"; } elseif($a < 0){ echo "a is negative integer\n"; } else{ echo "a is zero\n"; } //find leap year if($b % 100 == 0){ if($b % 400 == 0){ echo "b is leap year\n"; } else{ echo "b is not a leap year\n"; } } elseif($b % 4 == 0){ echo "b is leap year\n"; } ?> |