3v4l.org

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

preferences:
38.04 ms | 402 KiB | 5 Q