PHP Ternary Operator with Example
The ternary operator is a shorthand for the if...else
statement.
Pseudocode
$result = $condition ? $value1 : $value2;
Example
$auth_check = false;
if ($auth_check ) {
$title = 'Logout';
} else {
$title = 'Login';
}
Share on Social Media