3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class X { var $_x = 0; function set($x) { $this->_x = $x; } function disp() { var_dump($this); } } $x = new X; $a[0] = $x; $x->set(2); $a[0]->disp(); $x->disp();
Output for 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
object(X)#1 (1) { ["_x"]=> int(2) } object(X)#1 (1) { ["_x"]=> int(2) }
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/BB58f on line 4 object(X)#1 (1) { ["_x"]=> int(2) } object(X)#1 (1) { ["_x"]=> int(2) }
Output for 4.3.0 - 4.4.9
object(x)(1) { ["_x"]=> int(0) } object(x)(1) { ["_x"]=> int(2) }