3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testing { protected function _getClass() { return 'testing_two'; } public function new() { return new $this->_getClass(); } } class testing_two extends testing { } $a = new testing(); var_dump($a->new());

preferences:
48.99 ms | 402 KiB | 5 Q