1--TEST--
2Test array_intersect_ukey() function : usage variation - Passing class/object methods to callback
3--FILE--
4<?php
5echo "*** Testing array_intersect_ukey() : usage variation ***\n";
6
7//Initialise arguments
8$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
9$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);
10
11class MyClass
12{
13    static function static_compare_func($key1, $key2) {
14        return strcasecmp($key1, $key2);
15    }
16
17    public function class_compare_func($key1, $key2) {
18        return strcasecmp($key1, $key2);
19    }
20
21}
22
23echo "\n-- Testing array_intersect_ukey() function using class with static method as callback --\n";
24var_dump( array_intersect_ukey($array1, $array2, array('MyClass','static_compare_func')) );
25var_dump( array_intersect_ukey($array1, $array2, 'MyClass::static_compare_func') );
26
27echo "\n-- Testing array_intersect_uassoc() function using class with regular method as callback --\n";
28$obj = new MyClass();
29var_dump( array_intersect_ukey($array1, $array2, array($obj,'class_compare_func')) );
30?>
31--EXPECT--
32*** Testing array_intersect_ukey() : usage variation ***
33
34-- Testing array_intersect_ukey() function using class with static method as callback --
35array(2) {
36  ["blue"]=>
37  int(1)
38  ["green"]=>
39  int(3)
40}
41array(2) {
42  ["blue"]=>
43  int(1)
44  ["green"]=>
45  int(3)
46}
47
48-- Testing array_intersect_uassoc() function using class with regular method as callback --
49array(2) {
50  ["blue"]=>
51  int(1)
52  ["green"]=>
53  int(3)
54}
55