3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { private $x; public function setX($x) { $this->x = $x; } public function getX() { return $this->x; } } function test() : Foo { return new Foo(); } $x = test(); $x->setX('test'); var_dump($x->getX());

preferences:
50.99 ms | 402 KiB | 5 Q