PHP7 中 ?? 与? :的区别
2022-07-28 15:20:24
116
{{single.collect_count}}

??是PHP7版本的新特性,它与?:的区别在哪里呢

??

$b = $a?? $c ;相当于$b= isset($a)?$a:$c;

?:

$b = $a?$a: $c 则是 $b = !empty($a) ? $a:$c;

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}