Based on a conditional true or false, the Ternary operator choose one of the two results.
Let's have a look at the format.
condition ? result1 : result2
This operator has three sections.
First section is the condition.
Second section is the result that will be chosen if the condition returns true.
Third section is the result that will be chosen if the condition returns false.
After conditional block or first section, there is a question mark.
Two result sections will be separated by a colon.
Let's see an example.
In this example, $n1 has lower value than $n2, hence condition fails, and FALSE will be returned and displayed.
$n1 = 5;
$n2 = 15;
Again, in this example, value 10 is less than or equal to 14 and condition succeeded, and hence "Good Morning" will be returned and displayed.
$n1 = 10;
$n2 = 14;