3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbstractFoo { public $bar; final public function __construct() { $this->bar = static::BAR; } } class FooBar extends AbstractFoo { const BAR = 'foobar'; } class Foo extends AbstractFoo { //const BAR = 'foobar'; } $fooBar = new FooBar(); var_dump($fooBar->bar); $foo = new Foo(); var_dump($foo->bar);

preferences:
23.61 ms | 404 KiB | 5 Q