PHP question mark

前端 未结 7 1488
北荒
北荒 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:15

    It is the ternary operator: it means

    if $likesObj->isAlreadyLikedByUser(facebookUID()) is true assign style="display:none; to the variable, otherwise assign ''

提交回复
热议问题