3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function get($what) { return constant("self::" . $what); } } class Test2 extends Test { const OMG = 11; } $test = new Test(); var_dump($test->get("OMG")); var_dump($test::OMG);

preferences:
55.94 ms | 402 KiB | 5 Q