3v4l.org

run code in 200+ php & hhvm versions
<?php $arr = [0 => 1, 1 => 2, 2 => 3]; $obj = (object) $arr; var_dump($obj);
based on 8SdAk
Output for 7.2.0 - 7.3.1
object(stdClass)#1 (3) { ["0"]=> int(1) ["1"]=> int(2) ["2"]=> int(3) }
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.1.25
object(stdClass)#1 (3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }