3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $o = new stdClass(); $o->{0} = 'foo'; $a = (array) $o; var_dump($a); var_dump($a[0]); var_dump($a['0']);
based on gIBBF
Output for 7.2.0 - 7.2.6
array(1) { [0]=> string(3) "foo" } string(3) "foo" string(3) "foo"
Output for 5.5.0 - 7.1.20
array(1) { ["0"]=> string(3) "foo" } Notice: Undefined offset: 0 in /in/Gsjtv on line 6 NULL Notice: Undefined offset: 0 in /in/Gsjtv on line 7 NULL