配列および連想配列の連結について、ちょっと調べた。
(1) + 要素の連結
$test = array('A'); $test += array('A'); ------------------------------- array( (int) 0 => 'A' )
(2) + 要素の連結
$test = array(0=>'A'); $test += array(1=>'A'); ------------------------------- array( (int) 0 => 'A', (int) 1 => 'A' )
(3) array_push 要素の追加
$test = array('A'); array_push($test, 'A'); ------------------------------- array( (int) 0 => 'A', (int) 1 => 'A' )
(4) array_push 要素の追加
$test = array(0=>'A'); array_push($test, array(1=>'A')); ------------------------------- array( (int) 0 => 'A', (int) 1 => array( (int) 1 => 'A' ) )
(5) array_merge 要素の連結
$test = array('a'=>'A'); $test = array_merge($test, array('a'=>'A')); ------------------------------- array( 'a' => 'A' )
(6) array_merge 要素の連結
$test = array('a'=>'A'); $test = array_merge($test, array('b'=>'A')); ------------------------------- array( 'a' => 'A', 'b' => 'A' )
(7) array_merge 要素の連結
$test = array(0=>'A'); $test = array_merge($test, array(0=>'A')); ------------------------------- array( (int) 0 => 'A', (int) 1 => 'A' )
(8) array_merge 要素の連結
$test = array(1=>'A'); $test = array_merge($test, array(5=>'A')); ------------------------------- array( (int) 0 => 'A', (int) 1 => 'A' )