blob: e15d962b160d2a9bceb450b5192d0b482e3db60a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
--TEST--
Test get_class_methods() function : basic functionality
--FILE--
<?php
/* Prototype : proto array get_class_methods(mixed class)
* Description: Returns an array of method names for class or class instance.
* Source code: Zend/zend_builtin_functions.c
* Alias to functions:
*/
/*
* Test behaviour with interfaces.
*/
interface I {
public function pubI();
}
class C implements I {
public function pubI() {}
private function privC() {}
protected function protC() {}
public function pubC() {}
public static function testFromC() {
echo "Accessing I from C:\n";
var_dump(get_class_methods("I"));
echo "Accessing C from C:\n";
var_dump(get_class_methods("C"));
}
}
echo "Accessing I from global scope:\n";
var_dump(get_class_methods("I"));
echo "Accessing C from global scope:\n";
var_dump(get_class_methods("C"));
C::testFromC();
echo "Done";
?>
--EXPECT--
Accessing I from global scope:
array(1) {
[0]=>
string(4) "pubI"
}
Accessing C from global scope:
array(3) {
[0]=>
string(4) "pubI"
[1]=>
string(4) "pubC"
[2]=>
string(9) "testFromC"
}
Accessing I from C:
array(1) {
[0]=>
string(4) "pubI"
}
Accessing C from C:
array(5) {
[0]=>
string(4) "pubI"
[1]=>
string(5) "privC"
[2]=>
string(5) "protC"
[3]=>
string(4) "pubC"
[4]=>
string(9) "testFromC"
}
Done
|