3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(E_STRICT | E_ALL); class y { public function __get($k) { } } class x extends y { protected $_x = array(); public function &__get($k) { return $this->_x; } } $x =new x; $x->a['b'] = 4; print_r($x);
based on Xtc62
Output for 5.3.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
x Object ( [_x:protected] => Array ( [b] => 4 ) )
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.4 - 5.1.6, 5.2.1 - 5.3.3
Strict Standards: Declaration of x::__get() should be compatible with that of y::__get() in /in/d3TcF on line 13 x Object ( [_x:protected] => Array ( [b] => 4 ) )
Output for 5.2.0
Strict Standards: Declaration of x::__get() should be compatible with that of y::__get() in /in/d3TcF on line 13 Notice: Indirect modification of overloaded property x::$a has no effect in /in/d3TcF on line 16 x Object ( [_x:protected] => Array ( ) )
Output for 5.0.0 - 5.0.3
Strict Standards: Declaration of x::__get() should be compatible with that of y::__get() in /in/d3TcF on line 13 Fatal error: Cannot access undefined property for object with overloaded property access in /in/d3TcF on line 16
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/d3TcF on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/d3TcF on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/d3TcF on line 4
Process exited with code 255.