可能重複:
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