3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
object(foo)#1 (1) { ["bar"]=> int(2) } object(foo)#1 (1) { ["bar"]=> int(2) }
Output for 4.3.0 - 4.4.9
Notice: Undefined property: bar in /in/1Tnq4 on line 8 object(foo)(1) { ["bar"]=> int(1) } object(foo)(0) { }