PHP 8.0

Released 26 November 2020.


Major new features:

named arguments, eg. f(name: 'Alice')

attributes, eg. #[MyAttribute]

constructor property promotion

union types, eg. int|string, and the mixed type

match expression

nullsafe operator ?->

WeakMap


Minor new features:

str_contains(), str_starts_with(), str_ends_with()

the Stringable interface

throw as an expression, and non-capturing catch, eg. catch (Exception)