3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct( public ?array $meta = null, ) {} } class Bar { public ?array $meta = null; public function __construct(?array $meta = null) { $this->meta = $meta; } } $foo = new ReflectionClass(new Foo); $bar = new ReflectionClass(new Bar); var_dump($foo->getProperty('meta')->hasDefaultValue()); var_dump($bar->getProperty('meta')->hasDefaultValue());
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
bool(false) bool(true)

preferences:
47.72 ms | 406 KiB | 5 Q