1--TEST--
2Test array_diff_ukey() function : error conditions
3--FILE--
4<?php
5/* Prototype  : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
6 * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
7 * Source code: ext/standard/array.c
8 */
9
10echo "*** Testing array_diff_ukey() : error conditions ***\n";
11
12// Initialize
13$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
14$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);
15$extra_arg = 10;
16
17function key_compare_func($key1, $key2)
18{
19    if ($key1 == $key2) {
20        return 0;
21    }
22    return ($key1 > $key2)? 1:-1;
23}
24
25//Test array_diff_ukey with one more than the expected number of arguments
26echo "\n-- Testing array_diff_ukey() function with more than expected no. of arguments --\n";
27var_dump( array_diff_ukey($array1, $array2, 'key_compare_func', $extra_arg) );
28
29// Testing array_diff_ukey with one less than the expected number of arguments
30echo "\n-- Testing array_diff_ukey() function with less than expected no. of arguments --\n";
31var_dump( array_diff_ukey($array1, $array2) );
32
33// Testing array_diff_ukey with one less than the expected number of arguments
34echo "\n-- Testing array_diff_ukey() function with no arguments --\n";
35var_dump( array_diff_ukey() );
36?>
37===DONE===
38--EXPECTF--
39*** Testing array_diff_ukey() : error conditions ***
40
41-- Testing array_diff_ukey() function with more than expected no. of arguments --
42
43Warning: array_diff_ukey() expects parameter 4 to be a valid callback, no array or string given in %s on line %d
44NULL
45
46-- Testing array_diff_ukey() function with less than expected no. of arguments --
47
48Warning: array_diff_ukey(): at least 3 parameters are required, 2 given in %s on line %d
49NULL
50
51-- Testing array_diff_ukey() function with no arguments --
52
53Warning: array_diff_ukey(): at least 3 parameters are required, 0 given in %s on line %d
54NULL
55===DONE===
56