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);
based on nEHD0
Output for 5.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" } }
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" } }