PHP Ternary Operator for If Else

These two snippets of PHP perform the same function but the ternary operator takes much less space. Read more great PHP tips at phpro.org

/*** using if / else ***/
if(isset($variable))
{
echo $variable;
}
else
{
echo '';
}

/*** using ternary ***/
echo isset($variable) ? $variable : '';

Post comment