New In Initializers¶
It is possible to use a new expression for default values of static variables, arguments and properties.
<?php
function headers($a = new B()) : B {
return $a;
}
?>
See also PHP RFC: New in initializers
Added in PHP 8.1+