Annotation of embedaddon/php/ext/standard/tests/array/array_udiff_variation5.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
11: echo "*** 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:
17: echo "\n-- comparison function with an incorrect return value --\n";
18: function incorrect_return_value ($val1, $val2) {
19: return array(1);
20: }
21: var_dump(array_udiff($arr1, $arr2, 'incorrect_return_value'));
22:
23: echo "\n-- comparison function taking too many parameters --\n";
24: function too_many_parameters ($val1, $val2, $val3) {
25: return 0;
26: }
27: var_dump(array_udiff($arr1, $arr2, 'too_many_parameters'));
28:
29: echo "\n-- comparison function taking too few parameters --\n";
30: function too_few_parameters ($val1) {
31: return 0;
32: }
33: var_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 --
41: array(1) {
42: [0]=>
43: int(1)
44: }
45:
46: -- comparison function taking too many parameters --
47:
48: Warning: Missing argument 3 for too_many_parameters() in %sarray_udiff_variation5.php on line %d
49: array(0) {
50: }
51:
52: -- comparison function taking too few parameters --
53: array(0) {
54: }
55: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>