3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { protected $bar = array('baz'); function bar() { array_pop($this->bar); $vars = get_object_vars($this); $this->bar[] = array('buz'); print_r($vars); } function foo() { array_pop($this->bar); $dummy = &$this->bar; $vars = get_object_vars($this); $this->bar[] = array('buz'); print_r($vars); } } (new A())->bar(); (new A())->foo();
Output for 5.4.11 - 5.6.28, 7.0.3 - 7.2.0
Array ( [bar] => Array ( ) ) Array ( [bar] => Array ( [0] => Array ( [0] => buz ) ) )
Output for 7.0.0 - 7.0.2
Array ( [bar] => Array ( [0] => Array ( [0] => buz ) ) ) Array ( [bar] => Array ( [0] => Array ( [0] => buz ) ) )
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/WPh7K on line 23
Process exited with code 255.