3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $x; static function myCtr() { $obj = new self; $obj->x = 42; return $obj; } public function getX() { return $this->x; } } $foo = Foo::myCtr(); echo $foo->getX();

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
128.46 ms | 2033 KiB | 10 Q