Annotation of embedaddon/php/ext/standard/tests/array/array_diff_uassoc_variation7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_diff_uassoc() function : usage variation - Comparing strings containing integers and float
3: --FILE--
4: <?php
5: /* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
6: * Description: Computes the difference of arrays with additional index check which is performed by a
7: * user supplied callback function
8: * Source code: ext/standard/array.c
9: */
10:
11: echo "*** Testing array_diff_uassoc() : usage variation ***\n";
12:
13: //Initialize variables
14: $arr_string_int = array('1', '2');
15: $arr_string_float = array('0' => '1.00', '1.00' => '2.00');
16:
17: function key_compare_func($key1, $key2)
18: {
19: if ($key1 === $key2) {
20: return 0;
21: }
22: return ($key1 > $key2)? 1:-1;
23: }
24:
25: echo "\n-- Result of comparing strings containing integers and strings containing floating points --\n";
26: var_dump( array_diff_uassoc($arr_string_int, $arr_string_float, "key_compare_func") );
27: var_dump( array_diff_uassoc($arr_string_float, $arr_string_int, "key_compare_func") );
28:
29: ?>
30: ===DONE===
31: --EXPECTF--
32: *** Testing array_diff_uassoc() : usage variation ***
33:
34: -- Result of comparing strings containing integers and strings containing floating points --
35: array(2) {
36: [0]=>
37: string(1) "1"
38: [1]=>
39: string(1) "2"
40: }
41: array(2) {
42: [0]=>
43: string(4) "1.00"
44: ["1.00"]=>
45: string(4) "2.00"
46: }
47: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>