3v4l.org

run code in 200+ 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 'Underscore: ' . $prop . "\n"; } } } $b = new bar; $b->test; $b->_test;
Output for 5.0.0 - 7.3.0rc4
Base: test Underscore: _test
Output for 4.3.0 - 4.4.9
Notice: Undefined property: test in /in/VPn6J on line 21 Notice: Undefined property: _test in /in/VPn6J on line 22