$a = 1; $b = 2; /* if */ if ($a > $b)echo "a is greater than b"; /* else */ if ($a > $b) {echo "a is greater than b"; } else { echo "a is NOT greater than b"; } /* elseif */ if ($a > $b) {echo "a is greater than b"; } elseif ($a == $b) { echo "a is equal to b"; } else { echo "a is less than b"; } /* switch */ switch ($i) {case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; } |
PHP : Condition statement
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment