Description Algemeen
Per PHP versie
5.6
const
... for variadic function parameters and array unpacking.
** Exponentation operator
7.0
Function return type declarations: string, ìnt, float, bool, array (type ...$types).
Function parameter type declarations: string, ìnt, float, bool, array.
Null coalescing operator: ??
Spaceship operator: <=>
Constant arrays: define('FOO] , [1, 2, 3])
Anonymous classes: new class [implements Interface] {}
Group use declarations: use some\namespace\{ClassA, ClassB, ClassC as C};
preg_replace_callback_array()
7.1
Nullable function parameter and return types: function d(?int $foo): ?string.
Void functions: function f(): void
Array destructuring (list() shorthand): [$foo, $bar] = [1, 2]
Scoped class constants.
Iterable pseudo-type: function f(iterable $i)
Multi catch exception handling: catch (Exception1 | Exception2 | .... $e)
Keys in list() and array destructuring: ['foo' => $item1, 'bar' => $item2] = ['foo' => 1, 'bar' => 2]
7.2
7.3
More flexible Heredoc and Nowdoc.
7.4
Typed class properties.
Arrow functions.
Limited return type covariance and argument type contravariance.
Null coalescing assignment operator: ??=
Unpacking inside arrays: [1, 2, ...[3, 4], 5]
8.0
8.1
Array Unpacking with String Keys: [1, 2, [...['foo' => 3, 'bar' => 4], 5]
Enumerations
First Class Callable Syntax : $fn = callable(...)
Intersection types : function f(Foo&Bar $param)
Never return type: function f(): never { exit; }
new in Initializers: default value of a parameter, static variable, global constant initializers, and as attribute arguments.
Readonly properties
Final class constants: final public const foo = "bar";
8.2
SensitiveParameter Attribute: #[\SensitiveParameter]
Stand alone types null, false and true.
Intersection and union types can be combined.
Readonly classes .
Reactions are currently unavailable
You can’t perform that action at this time.
Algemeen
Per PHP versie
const...for variadic function parameters and array unpacking.**Exponentation operatorstring,ìnt,float,bool,array(type ...$types).string,ìnt,float,bool,array.??<=>define('FOO] , [1, 2, 3])new class [implements Interface] {}use some\namespace\{ClassA, ClassB, ClassC as C};function d(?int $foo): ?string.function f(): voidlist()shorthand):[$foo, $bar] = [1, 2]function f(iterable $i)catch (Exception1 | Exception2 | .... $e)list()and array destructuring:['foo' => $item1, 'bar' => $item2] = ['foo' => 1, 'bar' => 2]object??=[1, 2, ...[3, 4], 5]function f(Foo|Bar $param)match(expression) {...}?->mixedget_class($object)shorthand:$object::classstr_contains(),str_starts_with(),str_ends_with()[1, 2, [...['foo' => 3, 'bar' => 4], 5]$fn = callable(...)function f(Foo&Bar $param)function f(): never { exit; }newin Initializers: default value of a parameter, static variable, global constant initializers, and as attribute arguments.final public const foo = "bar";#[\SensitiveParameter]null,falseandtrue.