3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class test { protected $a = 'ciao'; public function salute() { $this->a = 'a'; echo $this->$a; } public function __get($name) { var_dump($name); return $this->$name; } } $test = new test(); $test->salute();
based on cVQ8b
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: a in /in/44r0g on line 9 string(0) "" Notice: Undefined property: test::$ in /in/44r0g on line 15
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: a in /in/44r0g on line 9 string(0) "" Fatal error: Uncaught Error: Cannot access empty property in /in/44r0g:15 Stack trace: #0 /in/44r0g(9): test->__get('') #1 /in/44r0g(20): test->salute() #2 {main} thrown in /in/44r0g on line 15
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Notice: Undefined variable: a in /in/44r0g on line 9 string(0) "" Fatal error: Cannot access empty property in /in/44r0g on line 15
Process exited with code 255.