3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { static public function getNew() { return new static; } } $obj1 = new Test(); $obj2 = new $obj1; var_dump($obj2);

preferences:
39.48 ms | 402 KiB | 5 Q