What is this alternative if/else syntax in PHP called?

前端 未结 2 1652
一向
一向 2020-12-31 17:29

What is the name of the following type of if/else syntax:

print $foo = ($hour < 12) ? \"Good morning!\" : \"Good afternoon!\";

I couldn\

2条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 18:24

    It's called the ternary operator - although many people call it the "?: operator" because "ternary" is such a seldom-used word.

提交回复
热议问题