1--TEST-- 2Test 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 15echo "*** 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 23var_dump( array_intersect($arr_binary, $arr_normal) ); 24 25// array with binary value for $arr2 argument 26var_dump( array_intersect($arr_normal, $arr_binary) ); 27 28// array with binary value for both $arr1 and $arr2 argument 29var_dump( array_intersect($arr_binary, $arr_binary) ); 30 31echo "Done"; 32?> 33--EXPECT-- 34*** Testing array_intersect() : binary safe checking *** 35array(2) { 36 [0]=> 37 string(5) "hello" 38 [1]=> 39 string(5) "world" 40} 41array(2) { 42 [0]=> 43 string(5) "hello" 44 [1]=> 45 string(5) "world" 46} 47array(2) { 48 [0]=> 49 string(5) "hello" 50 [1]=> 51 string(5) "world" 52} 53Done 54