3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DTO { public function __construct( public array $prop = [] ) {} } $default = (new ReflectionProperty(DTO::class, 'prop'))->getDefaultValue(); var_dump($default); // Здесь NULL
Output for 8.0.0 - 8.0.15, 8.1.0 - 8.1.2
NULL
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.27
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting variable (T_VARIABLE) in /in/r9iv4 on line 6
Process exited with code 255.

preferences:
62.74 ms | 460 KiB | 5 Q