3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = []; $a[1] = 1; $a["1"] = 2; var_dump($a); $obj = new stdClass; $obj->{1} = 1; $obj->{"1"} = 2; var_dump($obj); $a2 = (array)$obj; var_dump($a2);
based on Qs0kl
Output for 7.2.0
array(1) { [1]=> int(2) } object(stdClass)#1 (1) { ["1"]=> int(2) } array(1) { [1]=> int(2) }
Output for 5.4.11 - 7.1.10
array(1) { [1]=> int(2) } object(stdClass)#1 (1) { ["1"]=> int(2) } array(1) { ["1"]=> int(2) }
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/huS2n on line 3
Process exited with code 255.