PHP question mark

前端 未结 7 1571
北荒
北荒 2020-12-31 02:29
$hideCode = $likesObj->isAlreadyLikedByUser(facebookUID()) ? \'style=\"display:none;\"\' : \'\';

Can anyone explain to me what that question mar

7条回答
  •  北海茫月
    2020-12-31 03:10

    It's part of a ternary operator. The first part is the conditional of an if-else statement. After the question mark is the "if" block, and after the colon is the "else" block.

提交回复
热议问题