可能重复: What are the PHP operators “?” and “:” called and what do they do?什么是?在PHP 5.3中?
<?PHP
require __DIR__.'/c.php';
if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))
throw new Exception('Error');
$c();
?>
Twitto使用提供了一些新的功能,如PHP 5.3:
- DIR不断
- ?:运算
- 匿名函数
是什么2号做的:在PHP 5.3?
此外,匿名函数是什么意思?那不是一段时间以来的事情吗?
已回答至少两次http://stackoverflow.com/questions/1080247/what-is-the-php-operator-called-and-what-does-it-do和http://stackoverflow.com/questions/2099834/what-does-this-syntax-in-php-mean – Gordon 2010-01-28 08:43:59
@gordon,我知道这些话题意味着什么,我认为这是不同的,因为该网站称它是5.3以及新的从未见过他们像“?:” – JasonDavis 2010-01-28 08:50:56
@戈登这些只是更长的形式。 @jasondavis,你有:和?在问题标题中倒退。 – RJFalconer 2010-01-28 08:54:39