1--TEST--
2ReflectionClass::hasProperty()
3--CREDITS--
4Robin Fernandes <robinf@php.net>
5Steve Seear <stevseea@php.net>
6--FILE--
7<?php
8class pubf {
9    public $a;
10    static public $s;
11}
12class subpubf extends pubf {
13}
14
15class protf {
16    protected $a;
17    static protected $s;
18}
19class subprotf extends protf {
20}
21
22class privf {
23    private $a;
24    static protected $s;
25}
26class subprivf extends privf  {
27}
28
29$classes = array("pubf", "subpubf", "protf", "subprotf",
30                 "privf", "subprivf");
31foreach($classes as $class) {
32    echo "Reflecting on class $class: \n";
33    $rc = new ReflectionClass($class);
34    echo "  --> Check for s: ";
35    var_dump($rc->hasProperty("s"));
36    echo "  --> Check for a: ";
37    var_dump($rc->hasProperty("a"));
38    echo "  --> Check for A: ";
39    var_dump($rc->hasProperty("A"));
40    echo "  --> Check for doesNotExist: ";
41    var_dump($rc->hasProperty("doesNotExist"));
42}
43?>
44--EXPECT--
45Reflecting on class pubf:
46  --> Check for s: bool(true)
47  --> Check for a: bool(true)
48  --> Check for A: bool(false)
49  --> Check for doesNotExist: bool(false)
50Reflecting on class subpubf:
51  --> Check for s: bool(true)
52  --> Check for a: bool(true)
53  --> Check for A: bool(false)
54  --> Check for doesNotExist: bool(false)
55Reflecting on class protf:
56  --> Check for s: bool(true)
57  --> Check for a: bool(true)
58  --> Check for A: bool(false)
59  --> Check for doesNotExist: bool(false)
60Reflecting on class subprotf:
61  --> Check for s: bool(true)
62  --> Check for a: bool(true)
63  --> Check for A: bool(false)
64  --> Check for doesNotExist: bool(false)
65Reflecting on class privf:
66  --> Check for s: bool(true)
67  --> Check for a: bool(true)
68  --> Check for A: bool(false)
69  --> Check for doesNotExist: bool(false)
70Reflecting on class subprivf:
71  --> Check for s: bool(true)
72  --> Check for a: bool(false)
73  --> Check for A: bool(false)
74  --> Check for doesNotExist: bool(false)
75