3v4l.org

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