PHPバージョン
4+
/* インデックス配列の結合 */
$array1 = [1, 2, 3];
$array2 = [4, 5, 6];

// 2つの配列を結合
$result = array_merge($array1, $array2);

print_r($result);
/*
出力:
    Array
    (
        [0] => 1
        [1] => 2
        [2] => 3
        [3] => 4
        [4] => 5
        [5] => 6
    )
*/

/* 連想配列の結合 */
$assoc_array1 = ['a' => 'red', 'b' => 'green'];
$assoc_array2 = ['c' => 'blue', 'd' => 'yellow'];

// 2つの配列を結合
$assoc_result = array_merge($assoc_array1, $assoc_array2);

print_r($assoc_result);
/*
出力:
    Array
    (
        [a] => red
        [b] => green
        [c] => blue
        [d] => yellow
    )
*/
array_merge(array array1, array2, array3, ...): array
$result = array_merge();
var_dump($result); // 出力: Warning: array_merge() expects at least 1 parameter...

$result = array_merge(null);
var_dump($result); // 出力: Warning: array_merge() expects at least 1 parameter...
$result = array_merge();
var_dump($result); // 出力: array(0) { }

$result = array_merge(null);
var_dump($result); // 出力: Fatal error: Uncaught TypeError:
$array1 = ['a' => 'apple', 'b' => 'banana'];
$array2 = ['b' => 'blueberry', 'c' => 'cherry'];

$result = array_merge($array1, $array2);

print_r($result);
/*
出力:
    Array
    (
        [a] => apple
        [b] => blueberry
        [c] => cherry
    )
*/
$array1 = [0 => 'apple', 1 => 'banana'];
$array2 = [1 => 'blueberry', 2 => 'cherry'];

$result = array_merge($array1, $array2);

print_r($result);
/*
出力:
    Array
    (
        [0] => apple
        [1] => banana
        [2] => blueberry
        [3] => cherry
    )
*/
$array1 = ['apple', 'banana', 'color' => 'red'];
$array2 = ['green', 'orange', 'color' => 'orange', 'shape' => 'circle'];

$result = array_merge($array1, $array2);
print_r($result);
/*
出力:
    Array
    (
        [0] => apple
        [1] => banana
        [color] => orange
        [2] => green
        [3] => orange
        [shape] => circle
    )
*/
// 1つ目の配列
$array1 = [
    'name' => 'John Doe',
    'age' => 30,
    'address' => [
        'street' => '123 Main Street',
        'city' => 'Anytown',
        'state' => 'CA'
    ]
];

// 2つ目の配列
$array2 = [
    'phone' => '123-456-7890',
    'email' => 'johndoe@example.com'
];

// 2つの配列を結合
$result = array_merge($array1, $array2);

// 結果を出力
print_r($result);
/*
出力:
    Array
    (
        [name] => John Doe
        [age] => 30
        [address] => Array
            (
                [street] => 123 Main Street
                [city] => Anytown
                [state] => CA
            )
        [phone] => 123-456-7890
        [email] => johndoe@example.com
    )
*/