
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
What does double question mark (??) operator mean in PHP ?
PHP 7 has added a new operator double question mark (??) operator. In PHP 7, the double question mark(??) operator known as Null Coalescing Operator.
It returns its first operand if it exists and is not NULL; otherwise, it returns its second operand. It evaluates from left to right. Null Coalescing operator also can be used in a chain format.
Let's take the below example to demonstrate the double question mark (??) operator.
Example
<?php //$a is not set echo $a ?? 9 ??45; ?>
Output
9
Example
<?php //$a is not set $b = 34; echo $a ?? $b ?? 7; ?>
Output
34
- Related Articles
- What does the Double Star operator mean in Python?
- What is the use of the double question mark “??” in Swift?
- Double not (!!) operator in PHP
- What does operator ~= mean in Lua?
- What does the Star operator mean in Python?
- What does the two question marks together (??) mean in C#?
- What Does a Double-Dash in Shell Commands Mean
- What does [Ss]* mean in regex in PHP?
- What is the meaning of the question mark "?" in Swift?
- What is double address operator(&&) in C++?
- What is the "double tilde" (~~) operator in JavaScript?
- Which number should replace the question mark?
- What is the Kotlin double-bang (!!) operator?
- How to remove question mark from corrplot in R?
- A comma operator question in C/C++ ?

Advertisements