3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [ 0 => ['test', 'test2', 'test3'], 1 => ['1test', '1test2', '1test3'] ]; $object = (object) $array; var_dump($object);
Output for 7.2.0
object(stdClass)#1 (2) { ["0"]=> array(3) { [0]=> string(4) "test" [1]=> string(5) "test2" [2]=> string(5) "test3" } ["1"]=> array(3) { [0]=> string(5) "1test" [1]=> string(6) "1test2" [2]=> string(6) "1test3" } }
Output for 5.4.11 - 7.1.10
object(stdClass)#1 (2) { [0]=> array(3) { [0]=> string(4) "test" [1]=> string(5) "test2" [2]=> string(5) "test3" } [1]=> array(3) { [0]=> string(5) "1test" [1]=> string(6) "1test2" [2]=> string(6) "1test3" } }
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ll5qZ on line 3
Process exited with code 255.