3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [1, 2, 4]; $obj = (object)$arr; var_dump($obj, $obj->{1}, $obj->{2}, $obj->{3});
Output for 7.2.0
Notice: Undefined property: stdClass::$3 in /in/vTCoV on line 6 object(stdClass)#1 (3) { ["0"]=> int(1) ["1"]=> int(2) ["2"]=> int(4) } int(2) int(4) NULL
Output for 5.4.11 - 7.1.10
Notice: Undefined property: stdClass::$1 in /in/vTCoV on line 6 Notice: Undefined property: stdClass::$2 in /in/vTCoV on line 6 Notice: Undefined property: stdClass::$3 in /in/vTCoV on line 6 object(stdClass)#1 (3) { [0]=> int(1) [1]=> int(2) [2]=> int(4) } NULL NULL NULL
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/vTCoV on line 3
Process exited with code 255.