3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $cat = '-1'; $dog = '1'; $otherKey = 'greeting'; $content1 = 'hi mom'; $content2 = 'hi dad'; $someArray = array(); $someArray[$cat][$otherKey][] = $content1; $someArray[$dog][$otherKey][] = $content1; var_dump($someArray);
Output for 4.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(2) { [-1]=> array(1) { ["greeting"]=> array(1) { [0]=> string(6) "hi mom" } } [1]=> array(1) { ["greeting"]=> array(1) { [0]=> string(6) "hi mom" } } }
Output for 4.3.0 - 4.3.2
array(2) { ["-1"]=> array(1) { ["greeting"]=> array(1) { [0]=> string(6) "hi mom" } } [1]=> array(1) { ["greeting"]=> array(1) { [0]=> string(6) "hi mom" } } }