Using Ternary Operators for Conditional Assignment in PHP


Simplify your conditional assignments with ternary operators.

Source Code

$message = ($logged_in) ? "Welcome back!" : "Please log in.";
echo $message;
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments