blob: ea25e5b98d2af3fd1e734d1f60178e916e7910bd (
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
|
--TEST--
SPL: Test class_implements() function : basic
--FILE--
<?php
/* Prototype : array class_implements(mixed what [, bool autoload ])
* Description: Return all classes and interfaces implemented by SPL
* Source code: ext/spl/php_spl.c
* Alias to functions:
*/
echo "*** Testing class_implements() : basic ***\n";
interface foo { }
class fooImpl implements foo {}
interface bar { }
class barImpl implements bar {}
class foobarImpl implements foo, bar {}
class fooViaBarImpl extends barImpl implements foo {}
class fooExtended extends fooImpl {}
s_var_dump(class_implements(new foobarImpl));
s_var_dump(class_implements('foobarImpl'));
s_var_dump(class_implements(new fooViaBarImpl));
s_var_dump(class_implements('fooViaBarImpl'));
s_var_dump(class_implements(new fooExtended));
s_var_dump(class_implements('fooExtended'));
function s_var_dump($arr) {
krsort($arr);
var_dump($arr);
}
?>
===DONE===
--EXPECT--
*** Testing class_implements() : basic ***
array(2) {
["foo"]=>
string(3) "foo"
["bar"]=>
string(3) "bar"
}
array(2) {
["foo"]=>
string(3) "foo"
["bar"]=>
string(3) "bar"
}
array(2) {
["foo"]=>
string(3) "foo"
["bar"]=>
string(3) "bar"
}
array(2) {
["foo"]=>
string(3) "foo"
["bar"]=>
string(3) "bar"
}
array(1) {
["foo"]=>
string(3) "foo"
}
array(1) {
["foo"]=>
string(3) "foo"
}
===DONE===
|