3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $name = 'foo'; public static function make() { $this->clazz = get_class($this); return new $this->clazz(); } } class Bar extends Foo { private $name = 'bar'; } print_r(Foo::make()); print_r(Bar::make());

preferences:
39.13 ms | 402 KiB | 5 Q