可能重复:
What is the PHP ? : operator called and what does it do?解释这个PHP速记
我喂就像一个混日子,但我并不完全了解情况,在此代码:
$var .= ($one || $two) ? function_one($one, $another) : function_two($two, $another);
这是否说如果$ one或$ two,那么$ var等于fuction_one(),否则function_two()?使用这种语法的目的是什么 - 速度?
好醇”三元:http://stackoverflow.com/questions/1080247/what-is-the-php-operator-called-and-what-does-它做 – 2010-06-10 20:40:06
这是封闭的,但关于它的用途 - 速度和更干净的代码,如下例所示:http://en.wikipedia.org/wiki/Conditional_operator#Usage – 2010-06-10 20:50:45
感谢大家的压倒性反应! – buley 2010-06-10 20:56:22