3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function a($time) { return new static(); } public static function b($time) { return new self(); } } var_dump(A::a()); var_dump(A::b());
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::a(), 0 passed in /in/VRv7S on line 16 and exactly 1 expected in /in/VRv7S:5 Stack trace: #0 /in/VRv7S(16): A::a() #1 {main} thrown in /in/VRv7S on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.29
Fatal error: Constructor A::a() cannot be static in /in/VRv7S on line 14
Process exited with code 255.

preferences:
84.25 ms | 402 KiB | 86 Q