1--TEST--
2Test array_intersect_uassoc() function : usage variation - arrays containing referenced variables
3--FILE--
4<?php
5/* Prototype  : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
6 * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
7 * Source code: ext/standard/array.c
8 */
9
10echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
11
12//Initialize variables
13$ref_var = 'a';
14$array1 = array('a', $ref_var);
15$array2 = array('a' => 1, &$ref_var);
16
17echo "\n-- Testing array_intersect_uassoc() function with referenced variable \$ref_var has value '$ref_var' --\n";
18var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );
19
20// re-assign reference variable to different value
21$ref_var = 10;
22echo "\n-- Testing array_intersect_uassoc() function with referenced variable \$ref_var value changed to $ref_var --\n";
23var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );
24
25//When array are referenced
26$array2 = &$array1;
27echo "\n-- Testing array_intersect_uassoc() function when \$array2 is referencd to \$array1 --\n";
28var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );
29?>
30===DONE===
31--EXPECT--
32*** Testing array_intersect_uassoc() : usage variation ***
33
34-- Testing array_intersect_uassoc() function with referenced variable $ref_var has value 'a' --
35array(1) {
36  [0]=>
37  string(1) "a"
38}
39
40-- Testing array_intersect_uassoc() function with referenced variable $ref_var value changed to 10 --
41array(0) {
42}
43
44-- Testing array_intersect_uassoc() function when $array2 is referencd to $array1 --
45array(2) {
46  [0]=>
47  string(1) "a"
48  [1]=>
49  string(1) "a"
50}
51===DONE===
52