In addition to the enlarged if – else statement that you will use in most cases, there is also a short structure for an if – else statement. This format uses the so-called “ternary operator ‘. The syntax of this shorthand structure is as follows:
1
$var = condition ? true : false;
- Condition = The condition which must be met.
- True = Executed if the condition is met.
- False = Executed if the condition failes.