Categories
PHP / MySQL

PHP 7.4 – Null coalescing assignment operator

The null coalescing assignment operator is a shorthand for null coalescing operations. Let’s take a example code So, instead of writing the previous code, we could write the following: If the value of the left-hand parameter is null, then the value of the right-hand parameter is used.

Categories
PHP / MySQL

PHP 7.4 – Arrow functions

Arrow functions also called “short closures”. We can always access the parent scope, there’s no need for the use keyword. Here is a simple example with an arrow function. Above code we can write as show below without arrow function

Categories
PHP / MySQL

PHP 7.4 – Numeric Literal Separator

PHP 7.4 allows for underscores to be used to visually separate numeric values. It looks like this: The underscores are simply ignored by the engine. i.e both are equal.