3v4l.org

run code in 300+ 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.29, 8.1.20 - 8.1.33, 8.2.7 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Cannot override final method FooBar::bar() in /in/loOqQ on line 24
Process exited with code 255.

preferences:
77.3 ms | 406 KiB | 5 Q