3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $x; public function __construct($x) { $this->x = $x; } public function printX() { var_dump($this->x); return $this; } } var_dump([]); $test = (new Test("Hello"))->printX(); var_dump($test);

preferences:
33.97 ms | 402 KiB | 5 Q