The shortest way to echo out stuff in views in PHP - when not using template engines - is, afaik, this one:
<?php if (!empty($x)) echo $x; ?>
For a deeper explanaition why using !empty
is a good choice please look here.
Is it possible to write this without writing the variable name twice (like in other languages), something like
!echo $x;
or
echo? $x;