Conditional Statement

IF
if (condition)
   code to be executed if condition is true;
elseif (condition)
   code to be executed if condition is true;
else
   code to be executed if condition is false;
Switch
switch (expression){
   case label1:
      code to be executed if expression = label1;
      break;  

   case label2:
      code to be executed if expression = label2;
      break;
      default:

   code to be executed
   if expression is different 
   from both label1 and label2;
}
Ternary Operator
$var_is_greater_than_two = ($var > 2 ? true : false); // returns true

results matching ""

    No results matching ""