Forum Moderators: coopster
I know how to use ternary operator and do so wherever possible, but I have come across a particular comparison which has stopped me in my tracks:-
if ($main == "1")
{
$var = isset($_GET['op']) ? strip_tags($_GET['op']) : 'secure';
}
else
{
$var= isset($_GET['op']) ? strip_tags($_GET['op']) : 'standard';
}
Basically this if statement works fine at the moment, but I am trying to reduce my code wherever possible as I learn more about php, thus, I think as this particular example can be re-written to 1 multiple part ternary. I hope my theory is right anyway!
Thanks for any help given. Just to reiterate, as it is it works fine I just want to refine it.
Cheers,
MRb