1--TEST--
2Test array_intersect_assoc() function : usage variations - binary safe checking
3--FILE--
4<?php
5/* Prototype  : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
6 * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
7 * Keys are used to do more restrictive check
8 * Source code: ext/standard/array.c
9*/
10
11/*
12* Testing the behavior of array_intersect_assoc() by passing array with
13* binary values for $arr1 and $arr2 argument.
14*/
15
16echo "*** Testing array_intersect_assoc() : binary safe checking ***\n";
17
18// array with binary values
19$arr_binary = array(b"hello", b"world");
20// simple array
21$arr_normal = array("hello", "world");
22
23// array with binary value for $arr1 argument
24var_dump( array_intersect_assoc($arr_binary, $arr_normal) );
25
26// array with binary value for $arr2 argument
27var_dump( array_intersect_assoc($arr_normal, $arr_binary) );
28
29// array with binary value for both $arr1 and $arr2 argument
30var_dump( array_intersect_assoc($arr_binary, $arr_binary) );
31
32echo "Done";
33?>
34--EXPECT--
35*** Testing array_intersect_assoc() : binary safe checking ***
36array(2) {
37  [0]=>
38  string(5) "hello"
39  [1]=>
40  string(5) "world"
41}
42array(2) {
43  [0]=>
44  string(5) "hello"
45  [1]=>
46  string(5) "world"
47}
48array(2) {
49  [0]=>
50  string(5) "hello"
51  [1]=>
52  string(5) "world"
53}
54Done
55