if ($expression) { $var = "foo"; } else { $var = "bar"; } # WRONG $expression ? $var = "foo" : $var = "bar"; # correct $var = $expression ? "foo" : "bar";
In reply to Re: Warning while using ternary operator
by Anonymous Monk
in thread Warning while using ternary operator
by simonz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |