3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class ParentClass { const TEST_CONSTANT = null; public function __construct() { if (!defined(self::TEST_CONSTANT)) { throw new Exception("Please define TEST_CONSTANT!"); } } abstract protected function someFunction(); } class ChildClass extends ParentClass { const TEST_CONSTANT = "value"; protected function someFunction() { //some functionality here } } $x = new ChildClass();

preferences:
54.72 ms | 402 KiB | 5 Q