This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.
It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …
<?PHP
require __DIR__.'/c.php';
if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))
throw new Exception('Error');
$c();
?>
Run Code Online (Sandbox Code Playgroud)
Twitto使用从PHP 5.3开始提供的几个新功能:
在PHP 5.3 中,数字2对?:做什么?
另外,匿名函数是什么意思?那不是已经存在了一段时间的东西吗?
php ternary-operator language-construct conditional-operator php-5.3