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

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

little bottle
Release: 2023-04-06 07:48:02
forward
4125 people have browsed it

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;
Copy after login

If you want to know more about PHP, please pay attention to PHP 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!

Related labels:
source:cnblogs.com
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template