1--TEST-- 2ReflectionProperty::getModifiers() 3--CREDITS-- 4Robin Fernandes <robinf@php.net> 5Steve Seear <stevseea@php.net> 6--FILE-- 7<?php 8 9function reflectProperty($class, $property) { 10 $propInfo = new ReflectionProperty($class, $property); 11 12 echo "**********************************\n"; 13 echo "Reflecting on property $class::$property\n\n"; 14 15 echo "getModifiers():\n"; 16 var_dump($propInfo->getModifiers()); 17 18 echo "\n**********************************\n"; 19} 20 21class TestClass 22{ 23 public $pub; 24 static public $stat = "static property"; 25 /** 26 * This property has a comment. 27 */ 28 protected $prot = 4; 29 private $priv = "keepOut"; 30} 31 32reflectProperty("TestClass", "pub"); 33reflectProperty("TestClass", "stat"); 34reflectProperty("TestClass", "prot"); 35reflectProperty("TestClass", "priv"); 36 37?> 38--EXPECT-- 39********************************** 40Reflecting on property TestClass::pub 41 42getModifiers(): 43int(256) 44 45********************************** 46********************************** 47Reflecting on property TestClass::stat 48 49getModifiers(): 50int(257) 51 52********************************** 53********************************** 54Reflecting on property TestClass::prot 55 56getModifiers(): 57int(512) 58 59********************************** 60********************************** 61Reflecting on property TestClass::priv 62 63getModifiers(): 64int(1024) 65 66********************************** 67