3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class User { public function getName() { return "SomeName"; } } $result = [ 'command' => 'getName()' ]; $user = new User(); echo $user->{${$result['command']}};
based on d5AQr
Output for 7.1.0 - 7.2.11
Notice: Undefined variable: getName() in /in/Cbdt4 on line 16 Notice: Undefined property: User::$ in /in/Cbdt4 on line 16
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: getName() in /in/Cbdt4 on line 16 Fatal error: Uncaught Error: Cannot access empty property in /in/Cbdt4:16 Stack trace: #0 {main} thrown in /in/Cbdt4 on line 16
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Undefined variable: getName() in /in/Cbdt4 on line 16 Fatal error: Uncaught Error: Cannot access empty property in /in/Cbdt4:16 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Undefined variable: getName() in /in/Cbdt4 on line 16 Fatal error: Cannot access empty property in /in/Cbdt4 on line 16
Process exited with code 255.