3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface OverrideInterfaceMethod { public function __construct( ?DateTime $dateTime = null ); } class SkipOverrideInterfaceMethod implements OverrideInterfaceMethod { public function __construct(private DateTime $dateTime = new DateTime('now')) { } }
Output for 8.5.0 - 8.5.13, 8.6.0
Fatal error: Declaration of SkipOverrideInterfaceMethod::__construct(DateTime $dateTime = <expression>) must be compatible with OverrideInterfaceMethod::__construct(?DateTime $dateTime = null) in /in/AiBL5 on line 13 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28
Fatal error: Declaration of SkipOverrideInterfaceMethod::__construct(DateTime $dateTime = <expression>) must be compatible with OverrideInterfaceMethod::__construct(?DateTime $dateTime = null) in /in/AiBL5 on line 13
Process exited with code 255.
Output for 8.0.1 - 8.0.16
Fatal error: Constant expression contains invalid operations in /in/AiBL5 on line 13
Process exited with code 255.
Output for 7.4.0 - 7.4.28
Parse error: syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE) in /in/AiBL5 on line 13
Process exited with code 255.

preferences:
19.27 ms | 1173 KiB | 6 Q