3v4l.org

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

preferences:
45.16 ms | 402 KiB | 5 Q