3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $variableName = 'location->city'; // Create new variable with the name defined in variable $variableName ${$variableName} = 'Chicago'; //Outputs: string(7) "MyValue" var_dump($location->city); //Outputs: string(7) "MyValue" var_dump(${'location->city'});
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: location in /in/bFgUl on line 6 Notice: Trying to get property of non-object in /in/bFgUl on line 6 NULL string(7) "Chicago"
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: location in /in/bFgUl on line 6 Notice: Cannot access property on non-object in /in/bFgUl on line 6 NULL string(7) "Chicago"
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: location in /in/bFgUl on line 6 Notice: Trying to get property of non-object in /in/bFgUl on line 6 NULL string(7) "Chicago"
Output for 4.3.0 - 4.4.9
Notice: Undefined variable: location in /in/bFgUl on line 6 NULL string(7) "Chicago"