xref: /PHP-7.2/Zend/tests/property_exists.phpt (revision 17ccbeec)
1--TEST--
2Testing property_exists()
3--FILE--
4<?php
5
6class aParent {
7	public static function staticTest() {
8		$a = new A;
9		var_dump(property_exists($a, "prot"));
10		var_dump(property_exists($a, "prot2"));
11		var_dump(property_exists($a, "prot3"));
12		print "------------------\n";
13		var_dump(property_exists("A", "prot"));
14		var_dump(property_exists("A", "prot2"));
15		var_dump(property_exists("A", "prot3"));
16		print "------------------\n";
17	}
18	public function nonstaticTest() {
19		$a = new A;
20		var_dump(property_exists($a, "prot"));
21		var_dump(property_exists($a, "prot2"));
22		var_dump(property_exists($a, "prot3"));
23		print "------------------\n";
24		var_dump(property_exists("A", "prot"));
25		var_dump(property_exists("A", "prot2"));
26		var_dump(property_exists("A", "prot3"));
27	}
28}
29
30class A extends aParent {
31	static public $prot = "prot";
32	static protected $prot2 = "prot";
33	static private $prot3 = "prot";
34}
35
36A::staticTest();
37
38$a = new a;
39$a->nonstaticTest();
40
41?>
42--EXPECT--
43bool(true)
44bool(true)
45bool(true)
46------------------
47bool(true)
48bool(true)
49bool(true)
50------------------
51bool(true)
52bool(true)
53bool(true)
54------------------
55bool(true)
56bool(true)
57bool(true)
58