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.12
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 hhvm-3.22.0
Fatal error: Uncaught Error: Object does not implement ArrayAccess in /in/V3d9c:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.3
Fatal error: Uncaught Error: Object does not implement ArrayAccess in /in/V3d9c:17 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: Object does not implement ArrayAccess in /in/V3d9c on line 17
Process exited with code 255.
Output for 5.4.0 - 5.6.38
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.