3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = ["foo"=>"bar"]; $key = "foo"; $obj = new stdClass; $obj->bar = 'xyz'; echo "{$obj->{ ${'data'}[$key] }}\n"; echo "{$obj->{ ${data}[$key] }}\n";
based on nCXJL
Output for 7.2.0
xyz Warning: Use of undefined constant data - assumed 'data' (this will throw an Error in a future version of PHP) in /in/LPSak on line 7 xyz
Output for 5.4.11 - 7.1.10
xyz Notice: Use of undefined constant data - assumed 'data' in /in/LPSak on line 7 xyz
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/LPSak on line 2
Process exited with code 255.