Return to array_intersect_assoc_variation10.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test 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: 16: echo "*** 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 24: var_dump( array_intersect_assoc($arr_binary, $arr_normal) ); 25: 26: // array with binary value for $arr2 argument 27: var_dump( array_intersect_assoc($arr_normal, $arr_binary) ); 28: 29: // array with binary value for both $arr1 and $arr2 argument 30: var_dump( array_intersect_assoc($arr_binary, $arr_binary) ); 31: 32: echo "Done"; 33: ?> 34: --EXPECTF-- 35: *** Testing array_intersect_assoc() : binary safe checking *** 36: array(2) { 37: [0]=> 38: string(5) "hello" 39: [1]=> 40: string(5) "world" 41: } 42: array(2) { 43: [0]=> 44: string(5) "hello" 45: [1]=> 46: string(5) "world" 47: } 48: array(2) { 49: [0]=> 50: string(5) "hello" 51: [1]=> 52: string(5) "world" 53: } 54: Done