3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array(); $arr['all'][] = 'bar'; var_dump( $arr ); /* $arr = array( 'all' => 'foo' ); $arr['all'][] = 'bar'; var_dump( $arr ); */ $arr = array( 'all' => array() ); $arr['all'][] = 'bar'; var_dump( $arr ); $arr = array( 'all' => array( 'foo' ) ); $arr['all'][] = 'bar'; var_dump( $arr );
based on EqpTU
Output for 4.3.0 - 7.2.6
array(1) { ["all"]=> array(1) { [0]=> string(3) "bar" } } array(1) { ["all"]=> array(1) { [0]=> string(3) "bar" } } array(1) { ["all"]=> array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" } }