PHP Syntax Statements Conditional Question ?:

 

- Info:

- This tutorial shows how to use "? :" conditional statement.

- Expression left from '?' is evaluated.

- If TRUE expression left from ':' is executed.

- If FALSE expression right from ':' is executed.

 

- Syntax:

condition ? code if true : code if false;

 

- Procedure:

- Create PHP Console Application Test.php.

 

Test.php

<?php

10 > 5 ? print("TRUE") : print("FALSE");

?>