1--TEST--
2Test array_diff_uassoc() function : usage variations - arrays containing referenced variables
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
11echo "*** Testing array_diff_uassoc() : usage variation ***\n";
12
13//Initialize variables
14$ref_var = 'a';
15$array1 = array('a', $ref_var);
16$array2 = array('a' => 1, &$ref_var);
17
18echo "\n-- Testing array_diff_uassoc() function with referenced variable \$ref_var has value '$ref_var' --\n";
19var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
20var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
21
22// re-assign reference variable to different value
23$ref_var = 10.00;
24echo "\n-- Testing array_diff_uassoc() function with referenced variable \$ref_var value changed to $ref_var --\n";
25var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
26var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
27
28//When array are refenced
29$array2 = &$array1;
30echo "\n-- Testing array_diff_uassoc() function when \$array2 is referenced to \$array1 --\n";
31var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
32var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
33
34?>
35===DONE===
36--EXPECT--
37*** Testing array_diff_uassoc() : usage variation ***
38
39-- Testing array_diff_uassoc() function with referenced variable $ref_var has value 'a' --
40array(1) {
41  [1]=>
42  string(1) "a"
43}
44array(1) {
45  ["a"]=>
46  int(1)
47}
48
49-- Testing array_diff_uassoc() function with referenced variable $ref_var value changed to 10 --
50array(2) {
51  [0]=>
52  string(1) "a"
53  [1]=>
54  string(1) "a"
55}
56array(2) {
57  ["a"]=>
58  int(1)
59  [0]=>
60  &float(10)
61}
62
63-- Testing array_diff_uassoc() function when $array2 is referenced to $array1 --
64array(0) {
65}
66array(0) {
67}
68===DONE===
69