3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { use Some; function bar () { echo "this is bar" . PHP_EOL; } } trait Some { abstract function bar(); function useBar() { echo "using parent bar function" . PHP_EOL; $this->bar(); } } (new Foo())->useBar();
Output for 8.1.10 - 8.1.33, 8.2.10 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
using parent bar function this is bar

preferences:
45.41 ms | 406 KiB | 5 Q