1--TEST--
2method_exists() on userspace classes; static & non-static methods with various visibilities.
3--FILE--
4<?php
5/* Prototype  : proto bool is_subclass_of(object object, string class_name)
6 * Description: Returns true if the object has this class as one of its parents
7 * Source code: Zend/zend_builtin_functions.c
8 * Alias to functions:
9 */
10
11Class B {
12	public function inherit_pub() {}
13	protected function inherit_prot() {}
14	private function inherit_priv() {}
15	static public function inherit_static_pub() {}
16	static protected function inherit_static_prot() {}
17	static private function inherit_static_priv() {}
18}
19
20Class C extends B {
21	public function pub() {}
22	protected function prot() {}
23	private function priv() {}
24	static public function static_pub() {}
25	static protected function static_prot() {}
26	static private function static_priv() {}
27}
28
29
30$methods = array(
31	'inherit_pub', 'inherit_prot', 'inherit_priv',
32	'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv',
33	'pub', 'prot', 'priv',
34	'static_pub', 'static_prot', 'static_priv',
35	'non_existent');
36
37echo "\n ---(Using string class name)---\n";
38foreach ($methods as $method) {
39  echo "Does C::$method exist? ";
40  var_dump(method_exists("C", $method));
41}
42
43echo "\n ---(Using object)---\n";
44$myC = new C;
45foreach ($methods as $method) {
46  echo "Does C::$method exist? ";
47  var_dump(method_exists($myC, $method));
48}
49
50echo "Done";
51?>
52--EXPECT--
53 ---(Using string class name)---
54Does C::inherit_pub exist? bool(true)
55Does C::inherit_prot exist? bool(true)
56Does C::inherit_priv exist? bool(true)
57Does C::inherit_static_pub exist? bool(true)
58Does C::inherit_static_prot exist? bool(true)
59Does C::inherit_static_priv exist? bool(true)
60Does C::pub exist? bool(true)
61Does C::prot exist? bool(true)
62Does C::priv exist? bool(true)
63Does C::static_pub exist? bool(true)
64Does C::static_prot exist? bool(true)
65Does C::static_priv exist? bool(true)
66Does C::non_existent exist? bool(false)
67
68 ---(Using object)---
69Does C::inherit_pub exist? bool(true)
70Does C::inherit_prot exist? bool(true)
71Does C::inherit_priv exist? bool(true)
72Does C::inherit_static_pub exist? bool(true)
73Does C::inherit_static_prot exist? bool(true)
74Does C::inherit_static_priv exist? bool(true)
75Does C::pub exist? bool(true)
76Does C::prot exist? bool(true)
77Does C::priv exist? bool(true)
78Does C::static_pub exist? bool(true)
79Does C::static_prot exist? bool(true)
80Does C::static_priv exist? bool(true)
81Does C::non_existent exist? bool(false)
82Done
83