目录

PHP else Keyword

❮ PHP Keywords

Example

Run some code when a condition is not met:

<?php
if (5 < 3) {
  echo "Five is less than three";
} else {
  echo "Five is not less than three";
}
?>
Try it Yourself »

Definition and Usage

The else keyword specifies a block of code which should run when the condition of an if statement is not met.


Related Pages

The if keyword.

The elseif keyword.

Read more about the if...elseif...else conditional in our PHP if else Tutorial.


❮ PHP Keywords