PHP 7 Null Coalescing Operator
PHP
One of the goodies in PHP 7 is the null coalescing operator.
This provides an easy method of setting a variable if it exists (i.e. is not null), or setting it to a default if null.
Remember - PHP 7 is required!
Examples
The expression (expr1) ?? (expr2) evaluates to expr2 if expr1 is NULL, and expr1 otherwise — PHP Manual
This is going to make setting defaults much neater and more readable.
comments powered by Disqus