How to use the "??
" operator in PHP7? The following article will introduce to you the usage of "??" in PHP7. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
??
operator in PHP7, let’s take a look at its specific function
??
is equivalent to
isset($a)? $a :$b;
Determine whether a variable a exists. If it exists, assign variable a. If it does not exist, assign variable b
Note that it is to determine whether a variable exists, not to determine whether a variable is empty
Look at the code directly
$a = $a ?? 1; var_dump($a);//1 $a = 5; $a = $a ?? 1; var_dump($a);//5 $a = 0; $a = $a ?? 1; var_dump($a);//0
This article is reproduced from: https://blog.csdn.net/kelinfeng16/article/details/103111710
More programming related content , please pay attention to the Introduction to Programming column on the php Chinese website!
The above is the detailed content of Using the '??' operator in PHP7. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
