Home >Backend Development >PHP Tutorial >php三元运算符

php三元运算符

WBOY
WBOYOriginal
2016-06-06 20:36:361299browse

php三元运算符

帮朋友问的。不清楚怎么讲。

回复内容:

php三元运算符

帮朋友问的。不清楚怎么讲。

这是 PHP 新版本增加的特性, $a ?: $b 就相当于 $a ? $a : $b 。一般用来判断值是否存在给默认值的时候比较方便。

http://php.net/manual/zh/language.operators.comparison.php#language.op...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn