3v4l.org

run code in 200+ 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 4.3.0 - 4.4.9, 7.2.0
array(2) { [5]=> int(5) [6]=> int(6) } int(5)
Output for 5.3.0 - 7.1.7
Notice: Undefined offset: 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