3v4l.org

run code in 300+ PHP versions simultaneously
<?php phpversion() >= "7.0.1" or die(); $obj = new stdClass(); $obj->bar = "xyz"; $data = array("foo" => "bar"); $key = "foo"; echo "{@$obj->{${data}[$key]}}\n";
Output for 7.4.0 - 7.4.1
Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/oOh76:9 Stack trace: #0 {main} thrown in /in/oOh76 on line 9
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13
Recoverable fatal error: Object of class stdClass could not be converted to string in /in/oOh76 on line 9
Process exited with code 255.
Output for 7.0.1 - 7.0.33
Catchable fatal error: Object of class stdClass could not be converted to string in /in/oOh76 on line 9
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0

preferences:
148.84 ms | 401 KiB | 196 Q