3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const HIGH = 0; public function getStatic() { return static::HIGH; } public function getSelf() { return self::HIGH; } } class B extends A { const HIGH = 100; } $a = new A(); $b = new B(); var_dump([ "a" => [ "self" => $a->getSelf(), "static" => $a->getStatic() ], "b" => [ "self" => $b->getSelf(), "static" => $b->getStatic() ] ]);

preferences:
50.52 ms | 402 KiB | 5 Q