3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $obj = new Obj; $obj->oele['boele'][] = 'foo'; print_r($obj); var_dump($obj->bar); if ( $obj->eh ); $obj->oele['foo'] = 'boele'; print_r($obj); class Obj { function __construct() { $this->foo = 'bar'; } function &__get($name) { $this->$name = null; $var = &$this->$name; switch ( $name ) { case 'bar': $var = 'magic foo'; break; } return $this->$name; } }
based on ZA8uN
Output for 5.0.4 - 5.1.6, 5.2.1 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Obj Object ( [foo] => bar [oele] => Array ( [boele] => Array ( [0] => foo ) ) ) string(9) "magic foo" Obj Object ( [foo] => bar [oele] => Array ( [boele] => Array ( [0] => foo ) [foo] => boele ) [bar] => magic foo [eh] => )
Output for hhvm-3.10.0

Process exited with code 137.
Output for 5.2.0
Notice: Indirect modification of overloaded property Obj::$oele has no effect in /in/FQZEX on line 5 Obj Object ( [foo] => bar [oele] => ) string(9) "magic foo" Obj Object ( [foo] => bar [oele] => Array ( [foo] => boele ) [bar] => magic foo [eh] => )
Output for 5.0.0 - 5.0.3
Fatal error: Cannot access undefined property for object with overloaded property access in /in/FQZEX on line 5
Process exited with code 255.
Output for 4.3.0 - 4.4.9
obj Object ( [oele] => Array ( [boele] => Array ( [0] => foo ) ) ) Notice: Undefined property: bar in /in/FQZEX on line 8 NULL Notice: Undefined property: eh in /in/FQZEX on line 10 obj Object ( [oele] => Array ( [boele] => Array ( [0] => foo ) [foo] => boele ) )