CKTIS / PHP
array_merge()
Combine arrays in argument order.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
array_merge(array ...$arrays): arrayCombine arrays in argument order. Later entries replace earlier values for string keys, while entries with integer keys are appended and renumbered from zero. It works for merging simple option maps but can change numeric identifiers. In PHP 8.4 calling array_merge() with no arguments returns an empty array.
Signature
array_merge(array ...$arrays): array
Example output
{"mode":"live","0":"A","1":"B"}
Examples
<?php
$a = ['mode'=>'test', 8=>'A'];
$b = ['mode'=>'live', 8=>'B'];
echo json_encode(array_merge($a, $b));
Result
{"mode":"live","0":"A","1":"B"}