For any methods or function which are meant to always throw exception or exit the code using things like: exit() or die()
a new return type of: noreturn
was added. The sample usage could be: function iWillAlwaysExit(): noreturn
.
typing
PHP 8.1 – New feature array_is_list()
Added a new check to array
to see if it contains only an int based keys in natural order (from 0 to n`). Useful when we want to ensure the array is consistent (untouched) and when we want to serialize an array
to json
to format of [0, 1, 2]
instead of object properties.