3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Point { final public function foo(): string { return 'foo'; } } final class PointChildren extends Point { public function foo(): string { return 'children'; } } $children = new PointChildren(); $children->foo();
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.5
Fatal error: Cannot override final method Point::foo() in /in/T6skX on line 13
Process exited with code 255.

preferences:
29.18 ms | 1136 KiB | 6 Q