3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $petsounds = array("cat" => "meow", "dog" => "woof", "snake" => "hiss"); $petsounds{'mouse'} = "squeak"; var_dump($petsounds); $obj = new stdClass; $obj->ps = $petsounds; $obj->ps{"fox"} = "Gding, ding, ding"; var_dump($obj); $obj->{'123'} = "the end"; var_dump($obj);
based on gD7ce
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(4) { ["cat"]=> string(4) "meow" ["dog"]=> string(4) "woof" ["snake"]=> string(4) "hiss" ["mouse"]=> string(6) "squeak" } object(stdClass)#1 (1) { ["ps"]=> array(5) { ["cat"]=> string(4) "meow" ["dog"]=> string(4) "woof" ["snake"]=> string(4) "hiss" ["mouse"]=> string(6) "squeak" ["fox"]=> string(17) "Gding, ding, ding" } } object(stdClass)#1 (2) { ["ps"]=> array(5) { ["cat"]=> string(4) "meow" ["dog"]=> string(4) "woof" ["snake"]=> string(4) "hiss" ["mouse"]=> string(6) "squeak" ["fox"]=> string(17) "Gding, ding, ding" } ["123"]=> string(7) "the end" }
Output for 4.3.0 - 4.4.9
array(4) { ["cat"]=> string(4) "meow" ["dog"]=> string(4) "woof" ["snake"]=> string(4) "hiss" ["mouse"]=> string(6) "squeak" } object(stdClass)(1) { ["ps"]=> array(5) { ["cat"]=> string(4) "meow" ["dog"]=> string(4) "woof" ["snake"]=> string(4) "hiss" ["mouse"]=> string(6) "squeak" ["fox"]=> string(17) "Gding, ding, ding" } } object(stdClass)(2) { ["ps"]=> array(5) { ["cat"]=> string(4) "meow" ["dog"]=> string(4) "woof" ["snake"]=> string(4) "hiss" ["mouse"]=> string(6) "squeak" ["fox"]=> string(17) "Gding, ding, ding" } [123]=> string(7) "the end" }