Home>Article>Backend Development> The difference between ?: and ?? among the new features of PHP7

The difference between ?: and ?? among the new features of PHP7

little bottle
little bottle forward
2019-04-20 16:46:22 3996browse

This article is about introducing the two new features of ?: and ?? in PHP, and using code to explain them. Interested friends can learn about them.

?: and ?? are new features added by PHP. We can understand it through the following code

$z = $x ?? $y; //等价于下面 $z = isset($x) ? $x : $y; $z = $x ?: $y; //等价于下面 $z = $x ? $x : $y;

If you want to know more about PHP, please pay attention toPHP on the PHP Chinese website Video tutorial.

The above is the detailed content of The difference between ?: and ?? among the new features of PHP7. For more information, please follow other related articles on the PHP Chinese website!

php
Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete