3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $object = (object) array( "foo" => 42, "" => 37, "bar" => 19, ); echo "+ object created:\n"; var_dump($o); echo "\nenum properties:\n"; foreach ($o as $p => $v) { var_dump($p); } echo "\nget_object_vars()\n"; var_dump(get_object_vars($o));
Output for 5.3.0 - 7.2.0
+ object created: Notice: Undefined variable: o in /in/N742H on line 8 NULL enum properties: Notice: Undefined variable: o in /in/N742H on line 10 Warning: Invalid argument supplied for foreach() in /in/N742H on line 10 get_object_vars() Notice: Undefined variable: o in /in/N742H on line 14 Warning: get_object_vars() expects parameter 1 to be object, null given in /in/N742H on line 14 NULL
Output for 5.1.0 - 5.2.17
+ object created: Notice: Undefined variable: o in /in/N742H on line 8 NULL enum properties: Notice: Undefined variable: o in /in/N742H on line 10 Warning: Invalid argument supplied for foreach() in /in/N742H on line 10 get_object_vars() Notice: Undefined variable: o in /in/N742H on line 14 bool(false)
Output for 5.0.4 - 5.0.5
+ object created: Notice: Undefined variable: o in /in/N742H on line 8 NULL enum properties: Warning: Invalid argument supplied for foreach() in /in/N742H on line 10 get_object_vars() bool(false)
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.3
+ object created: Notice: Undefined variable: o in /in/N742H on line 8 NULL enum properties: Warning: Invalid argument supplied for foreach() in /in/N742H on line 10 get_object_vars() bool(false)
Output for 4.3.11
+ object created: Notice: Undefined variable: o in /in/N742H on line 8 NULL enum properties: get_object_vars() bool(false)