$a = 5;$b = 3;/*if($a>$b){ echo $a;}else{ echo $b;}*/$c = ($a>$b?$a:$b); //三元运算符 (判断条件?值为true输出的内容:值为false是输出的内容); echo $c;
//三元运算符比较3个数的大小
$a = 1; $b = 2; $c = 3;$d = $a > $b ?($a> $c ? $a : $c) :($b > $c? $b : $c);echo $d;