what does ? sign in this statement?

Possible Duplicates:
quick php syntax question
Reference - What does this symbol mean in PHP?

$row_color = ($row_count % 2) ? $color1 : $color2;


This is called Ternary operator. Basically it is checking if row_count is odd number then assign row_color to color1 or else color2


it is extended IF syntax

it equals to

if ($row_count % 2)
  $row_color = $color1;
else
  $row_color = $color2;

这是三元运营商

链接地址: http://www.djcxy.com/p/57722.html

上一篇: 猫王操作员词源

下一篇: 什么? 签署此声明?