1--TEST--
2Test array_merge_recursive() function : usage variations - binary safe checking
3--FILE--
4<?php
5/* Prototype  : array array_merge_recursive(array $arr1[, array $...])
6 * Description: Recursively merges elements from passed arrays into one array
7 * Source code: ext/standard/array.c
8*/
9
10/*
11 * Testing the functionality of array_merge_recursive() by passing an array having binary values.
12*/
13
14echo "*** Testing array_merge_recursive() : array with binary data for \$arr1 argument ***\n";
15
16// array with binary values
17$arr1 = array(b"1", b"hello" => "hello", b"world", "str1" => b"hello", "str2" => "world");
18
19// initialize the second argument
20$arr2 = array(b"str1" => b"binary", b"hello" => "binary", b"str2" => b"binary");
21
22echo "-- With default argument --\n";
23var_dump( array_merge_recursive($arr1) );
24
25echo "-- With more arguments --\n";
26var_dump( array_merge_recursive($arr1, $arr2) );
27
28echo "Done";
29?>
30--EXPECTF--
31*** Testing array_merge_recursive() : array with binary data for $arr1 argument ***
32-- With default argument --
33array(5) {
34  [0]=>
35  string(1) "1"
36  ["hello"]=>
37  string(5) "hello"
38  [1]=>
39  string(5) "world"
40  ["str1"]=>
41  string(5) "hello"
42  ["str2"]=>
43  string(5) "world"
44}
45-- With more arguments --
46array(5) {
47  [0]=>
48  string(1) "1"
49  ["hello"]=>
50  array(2) {
51    [0]=>
52    string(5) "hello"
53    [1]=>
54    string(6) "binary"
55  }
56  [1]=>
57  string(5) "world"
58  ["str1"]=>
59  array(2) {
60    [0]=>
61    string(5) "hello"
62    [1]=>
63    string(6) "binary"
64  }
65  ["str2"]=>
66  array(2) {
67    [0]=>
68    string(5) "world"
69    [1]=>
70    string(6) "binary"
71  }
72}
73Done
74