The else Statementif (expr) statement else other_statement Sometimes you will want to execute a statement if a certain condition is true, but a different statement otherwise. That's what else does; it extends an if statement to execute a different statement in case the condition in the if expression evaluates to FALSE. For example, this code indicates which is bigger, $value1 or $value2: <?php if ($value1 > $value2) { echo "$value1 is larger than $value2"; } else { echo "$value1 is not larger than $value2"; } ?> The else statement is only executed if the if condition evaluates to FALSE. |