2 /* Prototype : array array_intersect_assoc(array $arr1, array $arr2 [, array $...])
3 * Description: Returns the entries of arr1 that have values which are present in all the other arguments.
4 * Keys are used to do more restrictive check
5 * Source code: ext/standard/array.c
9 * Testing array_intersect_assoc() function by passing values to $arr2 argument other than arrays
10 * and see that function emits proper warning messages wherever expected.
11 * The $arr1 argument passed is a fixed array.
14 echo "*** Testing array_intersect_assoc() : Passing non-array values to \$arr2 argument ***\n";
16 // array to be passsed to $arr1 as default argument
19 // additional array to be passed for intersection
20 $arr3 = array(1, 2, "one" => 1, "two" => 2);
22 // get an unset variable
29 public function __toString() {
30 return "Class A object";
39 // get a resource variable
40 $fp = fopen(__FILE__
, "r");
42 // unexpected values to be passed to $arr2 argument
81 /*22*/ @$undefined_var,
90 // loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
92 foreach($arrays as $unexpected_value) {
93 echo "\n-- Iteration $iterator --";
95 // Calling array_intersect_assoc() with default arguments
96 var_dump( array_intersect_assoc($arr1,$unexpected_value) );
98 // Calling array_intersect_assoc() with more arguments
99 var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
104 // close the file resource used