3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $obj = new stdClass; $obj->{'123'} = "foo"; $arr = (array) $obj; print_r($arr); $foo = var_export($arr['123']); // PHP4 only: "foo" echo $foo;
based on ROdjW
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Array ( [123] => foo ) Notice: Undefined offset: 123 in /in/nOKH7 on line 6 NULL
Output for hhvm-3.10.0 - 3.12.0
Array ( [123] => foo ) Notice: Undefined index: 123 in /in/nOKH7 on line 6 NULL1
Output for 5.3.0 - 5.3.29
Array ( [123] => foo ) Notice: Undefined index: 123 in /in/nOKH7 on line 6 NULL
Output for 5.0.0 - 5.2.17
Array ( [123] => foo ) Notice: Undefined index: 123 in /in/nOKH7 on line 6 NULL
Output for 4.3.0 - 4.4.9
Array ( [123] => foo ) 'foo'