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