在PHP中传递三元运算?

$foo = false;

$foo ? include 'myfile.php' : ;

doesn't work, what should i wrote as to avoid any instructions process in a ternary operation ?

equivalent to 'pass' in Python.

Its not possible to build a ternary operator without an else!

The only thing you could do is letting it empty:

$foo ? include 'myfile.php' : '';

But as Blaatpraat mentioned, it would be much more appropriate to use a simple IF statement

Just for fun:

$foo and include 'myfile.php';

Replace this: $foo ? include 'myfile.php' : ; with this:

$included = $foo ? include 'myfile.php' : '';

You could use a quick and dirty &&:

$foo && include 'myfile.php';

But it would be much clearer to have a simple if statement:

if( $foo ) { include 'myfile.php'; }