1--TEST-- 2Test array_intersect_assoc() function : basic functionality 3--FILE-- 4<?php 5/* 6* Testing the behavior of array_intersect_assoc() by passing different arrays for the arguments. 7* Function is tested by passing associative array as well as array with default keys. 8*/ 9 10echo "*** Testing array_intersect_assoc() : basic functionality ***\n"; 11 12// array with default keys 13$arr_default_keys = array(1, 2, "hello", 'world'); 14 15// associative array 16$arr_associative = array("one" => 1, "two" => 2); 17 18// default key array for both $arr1 and $arr2 argument 19var_dump( array_intersect_assoc($arr_default_keys, $arr_default_keys) ); 20 21// default key array for $arr1 and associative array for $arr2 argument 22var_dump( array_intersect_assoc($arr_default_keys, $arr_associative) ); 23 24// associative array for $arr1 and default key array for $arr2 25var_dump( array_intersect_assoc($arr_associative, $arr_default_keys) ); 26 27// associative array for both $arr1 and $arr2 argument 28var_dump( array_intersect_assoc($arr_associative, $arr_associative) ); 29 30// more arrays to be intersected 31$arr3 = array(2, 3, 4); 32var_dump( array_intersect_assoc($arr_default_keys, $arr_associative, $arr3) ); 33var_dump( array_intersect_assoc($arr_associative, $arr_default_keys, $arr3, $arr_associative) ); 34 35echo "Done"; 36?> 37--EXPECT-- 38*** Testing array_intersect_assoc() : basic functionality *** 39array(4) { 40 [0]=> 41 int(1) 42 [1]=> 43 int(2) 44 [2]=> 45 string(5) "hello" 46 [3]=> 47 string(5) "world" 48} 49array(0) { 50} 51array(0) { 52} 53array(2) { 54 ["one"]=> 55 int(1) 56 ["two"]=> 57 int(2) 58} 59array(0) { 60} 61array(0) { 62} 63Done 64