3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyCl { protected $db = "Hello"; // public function __get($property) { // // } } $obj = new MyCl(); $greet = $obj->db; var_dump($greet);
Output for 7.0.28 - 7.3.0rc3
Fatal error: Uncaught Error: Cannot access protected property MyCl::$db in /in/cp8i7:13 Stack trace: #0 {main} thrown in /in/cp8i7 on line 13
Process exited with code 255.
Output for 5.6.38
Fatal error: Cannot access protected property MyCl::$db in /in/cp8i7 on line 13
Process exited with code 255.