3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $obj = new stdClass(); $obj->{'apple'} = "foo"; $obj->{'beta'} = "bar"; var_dump($obj); $arr = (array)$obj; var_dump($arr); echo $arr["apple"]; echo $arr["beta"];
based on BavAT
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
object(stdClass)#1 (2) { ["apple"]=> string(3) "foo" ["beta"]=> string(3) "bar" } array(2) { ["apple"]=> string(3) "foo" ["beta"]=> string(3) "bar" } foobar
Output for 4.3.0 - 4.4.9
object(stdClass)(2) { ["apple"]=> string(3) "foo" ["beta"]=> string(3) "bar" } array(2) { ["apple"]=> string(3) "foo" ["beta"]=> string(3) "bar" } foobar