3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Pancakes { public $syrup; public function getSyrup() { return $this->{$syrup}; } } $pancakes = new Pancakes(); $pancakes->syrup = 'maple'; echo $pancakes->getSyrup();
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: syrup in /in/KMfYa on line 9 Notice: Undefined property: Pancakes::$ in /in/KMfYa on line 9
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: syrup in /in/KMfYa on line 9 Fatal error: Uncaught Error: Cannot access empty property in /in/KMfYa:9 Stack trace: #0 /in/KMfYa(16): Pancakes->getSyrup() #1 {main} thrown in /in/KMfYa on line 9
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Notice: Undefined variable: syrup in /in/KMfYa on line 9 Fatal error: Cannot access empty property in /in/KMfYa on line 9
Process exited with code 255.