3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class foo { function __get($prop) { echo 'Base: ' . $prop . "\n"; } } class bar extends foo { function __get($prop) { if (strpos($prop, '_') === false) { parent::__get($prop); } else { echo '_: ' . $prop . "\n"; } } } $b = new bar; $b->test; $b->_test;
Output for 5.0.0 - 7.1.0
Base: test _: _test
Output for 4.3.0 - 4.4.9
Notice: Undefined property: test in /in/AukQZ on line 21 Notice: Undefined property: _test in /in/AukQZ on line 22