3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Person { } $array = [ 'name' => 'John', 'username' => 'JohnDoe23', 'is_active' => true ]; $reflection = new ReflectionClass('Person'); foreach($array as $key => $value) { $reflection[$key] = $value; } var_dump($reflection);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot use object of type ReflectionClass as array in /in/V3d9c:17 Stack trace: #0 {main} thrown in /in/V3d9c on line 17
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Fatal error: Cannot use object of type ReflectionClass as array in /in/V3d9c on line 17
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/V3d9c on line 7
Process exited with code 255.