3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo; public static function create() { $obj = new static(); $obj->nope(); return $obj; } protected function nope() { $this->foo = 'asdf'; } public function getFoo() { return $this->foo; } } $foo = Foo::create(); var_dump($foo->getFoo());

preferences:
40.79 ms | 402 KiB | 5 Q