3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class SuperAbstract { static function create() { return new static(); } } class Extended extends SuperAbstract { private $hello = ''; protected function __construct() { $this->hello = "world"; } public function hello() { return "hello " . $this->hello; } } // works $a = Extended::create(); echo $a->hello(); echo "\n\nNow we'll fail, trying to call 'new' directly:\n"; // can't touch this $b = new Extended();

This is an error 500

There are `>1` results


preferences:
273.43 ms | 1013 KiB | 7 Q