This works:
\"/>
This does n
PHP's operator precedence rules make it evaluate your second example as follows:
echo(
('')
);
That doesn't make a lot of sense in several ways. And since the result of isset()
is essentially disregarded, this always ends up just trying to print $_POST['foo']
. And that results in a notice when it's not set, of course.
Add parentheses around the actual ternary expression. I.e.
(isset($_POST['foo']) ? $_POST['foo'] : '')