2 /* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
3 * Description: Merges elements from passed arrays into one array
4 * Source code: ext/standard/array.c
8 * Pass an array with different data types as keys to test how array_merge
9 * adds it onto an existing array
11 <<__EntryPoint
>> function main(): void
{
12 echo "*** Testing array_merge() : usage variations ***\n";
14 // Initialise function arguments not being substituted
15 $arr = dict
['one' => 1, 'two' => 2];
22 // arrays with keys as different data types to be passed as $input
34 /*2*/ 'empty double quotes' => dict
[
38 /*3*/ 'empty single quotes' => dict
[
43 /*4*/ 'string' => dict
[
44 "stringd" => 'stringd',
45 'strings' => 'strings',
46 $heredoc => 'stringh',
50 // loop through each element of $inputs to check the behavior of array_merge
52 foreach($inputs as $key => $input) {
53 echo "\n-- Iteration $iterator: $key data --\n";
54 var_dump( array_merge($input, $arr) );
55 var_dump( array_merge($arr, $input) );