Something I've noticed with ternary expressions is if you do something like :
<?= $var=="something" ? "is something" : "not something"; ?>
It will give wacky results sometimes...
So be sure to enclose the ternary expression in parenthesis when ever necessary (such as having multiple expressions or nested ternary expressions)
The above could look like:
<?= ($var=="something") ? "is something" : "not something"; ?>
It's also a good idea to use parenthesis when using something SIMILAR to:
echo (trim($var)=="") ? "empty" : "not empty";
In some cases other than the <?= ?> example, not placing the entire expression in appropriate parenthesis might yield undesirable results as well.. but I'm not quite sure.