3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $o = new stdClass(); $five = 5; $six = 6; $o->$five = 5; $o->$six = 6; $a = (array)$o; var_dump($a, $a[5]);
based on 1YDru
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 5 in /in/28YpV on line 8 array(2) { ["5"]=> int(5) ["6"]=> int(6) } NULL
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: 5 in /in/28YpV on line 8 array(2) { ["5"]=> int(5) ["6"]=> int(6) } NULL
Output for 5.0.0 - 5.2.17
Notice: Undefined offset: 5 in /in/28YpV on line 8 array(2) { ["5"]=> int(5) ["6"]=> int(6) } NULL
Output for 4.3.0 - 4.4.9
array(2) { [5]=> int(5) [6]=> int(6) } int(5)