$a = 2;
$a == 1 ? $test="Enterprise" : ($a==2 ? $test="Region" : $test="Other places");
echo $test;
First determine whether $a is 1. If it is, output the enterprise directly. If not, continue to judge, which is equivalent to nesting an if inside else. If it is equal to 2, output the region. If it is not, output elsewhere
is equivalent to
$a = 2;
if($a == 1) {
echo $test="Enterprise";
} else {
if($a == 2){
$test = "Region";
} else {
$test="Elsewhere";
}
}
echo $test;
or
if($a == 1) {
echo $test="Enterprise";
} else {
$a==2 ? $test="region" : $test="other places";
}
http://www.bkjia.com/PHPjc/477119.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477119.htmlTechArticle$a = 2; $a == 1 ? $test=Enterprise: ($a==2 ? $ test=region: $test=other places); echo $test; first determine whether $a is 1. If it is to output the enterprise directly, if not, continue to determine the equivalent of el...