3v4l.org

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