2 Test array_diff_assoc() function : error conditions - pass array_diff_assoc() too few/zero arguments
5 /* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
6 * Description: Returns the entries of arr1 that have values which are not present
7 * in any of the others arguments but do additional checks whether the keys are equal
8 * Source code: ext/standard/array.c
12 * Test errors for array_diff with too few\zero arguments
15 echo "*** Testing array_diff_assoc() : error conditions ***\n";
18 echo "\n-- Testing array_diff_assoc() function with zero arguments --\n";
20 var_dump( array_diff_assoc() );
21 } catch (ArgumentCountError $e) {
22 echo $e->getMessage(), "\n";
25 // Testing array_diff_assoc with one less than the expected number of arguments
26 echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n";
29 var_dump( array_diff_assoc($arr1) );
30 } catch (ArgumentCountError $e) {
31 echo $e->getMessage(), "\n";
37 *** Testing array_diff_assoc() : error conditions ***
39 -- Testing array_diff_assoc() function with zero arguments --
40 At least 2 parameters are required, 0 given
42 -- Testing array_diff_assoc() function with less than expected no. of arguments --
43 At least 2 parameters are required, 1 given