I just finished reading Marion Weerning's article on optimizing your pages (http://www.phpbuilder.com/) and I'm trying to get my head wrapped around trinary expressions.
I understand that this:
if ($x == '7') {
echo 'yes';
}
else [
echo 'no';
}
can be written as a trinary as follows:
echo ($x == 7) ? 'yes' : 'no';
which, I must agree with Marion, is a much cleaner way of writing it.
But what I'm wondering is can the following be written as a trinary expression. I've tried all kinds of combinations of what I thought might have worked, but I've come up empty handed.
if (isset($POST['blurb'])) { $blurb = $POST['blurb']; } else { $blurb = $page_info['blurb']; }
Should I just stick with what I've got, or is there a more efficient way to write this code?
Thanks!
JeNNiDeS
Budding PHP Sharp shooter