3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { function __construct () { $this->bar = 1; } function add() { $this->bar+=1; } } $one = $two = $three = new foo(); $one->add(); var_dump($one); var_dump($two);

preferences:
36.83 ms | 402 KiB | 5 Q