3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class a { public function run() { echo "a::run get_class: " . get_class($this); echo "\na::run __CLASS__: " . __CLASS__; } } class b extends a{ public function run_b() { echo "b::run_b get_class: " . get_class($this); echo "\nb::run_b __CLASS__: " . __CLASS__; } } //$a = new a(); $b = new b(); //echo "\na->run();\n"; //$a->run(); echo "\n\nb->run();\n"; $b->run(); echo "\n\nb->run_b();\n"; $b->run_b();
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
b->run(); a::run get_class: b a::run __CLASS__: a b->run_b(); b::run_b get_class: b b::run_b __CLASS__: b

preferences:
216.89 ms | 404 KiB | 296 Q