3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Thing { private $x; public function __construct($x) { $this->$x = $x; } public function get() { return $this->x; } public function set($x) { $this->$x = $x; } } function f(Thing $t) { $t->set(42); } $t = new Thing(1); var_dump($t->get()); f($t); var_dump($t->get());

preferences:
49.43 ms | 402 KiB | 5 Q