3v4l.org

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

preferences:
39.58 ms | 402 KiB | 5 Q