3v4l.org

run code in 200+ php & hhvm versions
<?php $a = ['a', 'b']; $o = (object)$a; var_dump($o); $b = (array)$o; var_dump($b); var_dump($b[0]);
based on S7K9E
Output for 7.2.0 - 7.2.6
object(stdClass)#1 (2) { ["0"]=> string(1) "a" ["1"]=> string(1) "b" } array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } string(1) "a"
Output for 5.5.0 - 5.6.30, hhvm-3.12.14 - 3.21.0, 7.0.0 - 7.1.20
object(stdClass)#1 (2) { [0]=> string(1) "a" [1]=> string(1) "b" } array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } string(1) "a"