Intersection Types in PHP 8.1

Intersection Types in PHP 8.1

Since PHP 8.0, we can use union types which allows to provide two or more types for parameters, return values, and properties. Given value should be one of the specified…
First-class Callable Syntax in PHP 8.1

First-class Callable Syntax in PHP 8.1

PHP offers Closure::fromCallable static method which allows to create a new anonymous function also known as Closure from specified callback using the current scope. For example, if we want to…
New never Return Type in PHP 8.1

New never Return Type in PHP 8.1

PHP allows to define type declarations for parameters, return values, and properties. Since PHP 8.1, we can use never return type. It indicates that function or class method throws an…
Readonly Properties in PHP 8.1

Readonly Properties in PHP 8.1

Since PHP 8.1, class properties can be declared as readonly. This means that class property can be initialized once and cannot be modified later. Readonly properties are declared with readonly…
Default MySQLi Error Mode in PHP 8.1

Default MySQLi Error Mode in PHP 8.1

MySQLi is a PHP extension that allows to use the functionality provided by MySQL database. MySQLi supports five different error modes which defines how MySQLi should behave when error occurs.…