1--TEST--
2Test array_udiff() function : usage variation
3--FILE--
4<?php
5/* Prototype  : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
6 * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
7 * Source code: ext/standard/array.c
8 * Alias to functions:
9 */
10
11echo "*** Testing array_udiff() : usage variation ***\n";
12
13// Initialise function arguments not being substituted (if any)
14$arr1 = array(1);
15$arr2 = array(1);
16
17echo "\n-- comparison function with an incorrect return value --\n";
18function incorrect_return_value ($val1, $val2) {
19  return array(1);
20}
21var_dump(array_udiff($arr1, $arr2, 'incorrect_return_value'));
22
23echo "\n-- comparison function taking too many parameters --\n";
24function too_many_parameters ($val1, $val2, $val3) {
25  return 0;
26}
27var_dump(array_udiff($arr1, $arr2, 'too_many_parameters'));
28
29echo "\n-- comparison function taking too few parameters --\n";
30function too_few_parameters ($val1) {
31  return 0;
32}
33var_dump(array_udiff($arr1, $arr2, 'too_few_parameters'));
34
35?>
36===DONE===
37--EXPECTF--
38*** Testing array_udiff() : usage variation ***
39
40-- comparison function with an incorrect return value --
41array(1) {
42  [0]=>
43  int(1)
44}
45
46-- comparison function taking too many parameters --
47
48Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_variation5.php on line %d
49array(0) {
50}
51
52-- comparison function taking too few parameters --
53array(0) {
54}
55===DONE===
56