No, there is no way to skip this. If you want to skip the false bit, return to the if
method:
if (condition()) $string = 'something' . $string . 'something';
The ternary method is just a short if
. If you can make the if
as short without sacrificing readability (as in the example above), you should consider it.
But to be honest, I even formatted this to make it more readable:
if (condition()) $string = 'something' . $string . 'something';
If you do not have enough monitor height, it will be easier to understand at a glance :-)
source share