3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NotFinal { protected function hello($string = '' ) { echo 'hello'; } } final class ThisIsFinal extends NotFinal { public function hello(array $witharg) { return parent::hello(); } } $class = new ThisIsFinal(); $class->hello();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Declaration of ThisIsFinal::hello(array $witharg) must be compatible with NotFinal::hello($string = '') in /in/OZ7W6 on line 10
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of ThisIsFinal::hello(array $witharg) should be compatible with NotFinal::hello($string = '') in /in/OZ7W6 on line 10 Fatal error: Uncaught ArgumentCountError: Too few arguments to function ThisIsFinal::hello(), 0 passed in /in/OZ7W6 on line 16 and exactly 1 expected in /in/OZ7W6:10 Stack trace: #0 /in/OZ7W6(16): ThisIsFinal->hello() #1 {main} thrown in /in/OZ7W6 on line 10
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33
Warning: Declaration of ThisIsFinal::hello(array $witharg) should be compatible with NotFinal::hello($string = '') in /in/OZ7W6 on line 13 Fatal error: Uncaught ArgumentCountError: Too few arguments to function ThisIsFinal::hello(), 0 passed in /in/OZ7W6 on line 16 and exactly 1 expected in /in/OZ7W6:10 Stack trace: #0 /in/OZ7W6(16): ThisIsFinal->hello() #1 {main} thrown in /in/OZ7W6 on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Warning: Declaration of ThisIsFinal::hello(array $witharg) should be compatible with NotFinal::hello($string = '') in /in/OZ7W6 on line 13 Fatal error: Uncaught TypeError: Argument 1 passed to ThisIsFinal::hello() must be of the type array, none given, called in /in/OZ7W6 on line 16 and defined in /in/OZ7W6:10 Stack trace: #0 /in/OZ7W6(16): ThisIsFinal->hello() #1 {main} thrown in /in/OZ7W6 on line 10
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Declaration of ThisIsFinal::hello() should be compatible with NotFinal::hello($string = '') in /in/OZ7W6 on line 13 Catchable fatal error: Argument 1 passed to ThisIsFinal::hello() must be of the type array, none given, called in /in/OZ7W6 on line 16 and defined in /in/OZ7W6 on line 10
Process exited with code 255.

preferences:
172.38 ms | 402 KiB | 183 Q