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