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