3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Foo { final protected function bar() { echo 'Foo'; } } class FooBar { use Foo; public function __construct() { $this->bar(); } } class FooBarBar extends FooBar { protected function bar() { echo 'FooBarBar'; } } new FooBar();
Output for 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.35, 8.4.1 - 8.4.26
Fatal error: Cannot override final method FooBar::bar() in /in/loOqQ on line 24
Process exited with code 255.
Output for 8.5.0 - 8.5.11
Fatal error: Cannot override final method FooBar::bar() in /in/loOqQ on line 24 Stack trace: #0 {main}
Process exited with code 255.

preferences:
34.61 ms | 1139 KiB | 9 Q