3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { final public function a() { echo 1; } } class B extends A { public function b() { echo 2; } } $o = new B();
Output for 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.6
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.32, 7.2.0 - 7.2.23, 7.3.0 - 7.3.10
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in /in/NDfG7 on line 3 Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in /in/NDfG7 on line 9 Fatal error: Cannot override final A::a() with B::b() in /in/NDfG7 on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Cannot override final A::a() with B::b() in /in/NDfG7 on line 13
Process exited with code 255.

preferences:
197.82 ms | 402 KiB | 285 Q