3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $variableName = 'obj->foo'; // Create new variable with the name defined in variable $variableName $obj = (object) array( "foo" => "1", "bar" => "2", ); echo ${$variableName}; ${$variableName} = 'MyValue'; //Outputs: string(7) "MyValue" echo $foo;
based on XLO23
Output for 5.0.4 - 7.2.0
Notice: Undefined variable: obj->foo in /in/WDf8P on line 8 Notice: Undefined variable: foo in /in/WDf8P on line 11
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: obj->foo in /in/WDf8P on line 8 Notice: Undefined variable: foo in /in/WDf8P on line 11