note 93984 added to reflectionclass.getproperties

From: Date: Sat, 10 Oct 2009 00:30:44 +0000
Subject: note 93984 added to reflectionclass.getproperties
Groups: php.notes 
Request: Send a blank email to php-notes+get-161610@lists.php.net to get a copy of this message
It appears the filter parameter accepts a long value that is one of ReflectionProperty::IS_STATIC, ReflectionProperty::IS_PUBLIC, ReflectionProperty::IS_PROTECTED, or ReflectionProperty::IS_PRIVATE as a way to limit the returned properties. Flags may be combined by adding them together. Example: <?php class Foo { public $alpha = 1; protected $beta = 2; private $gamma = 3; public function listProperties() { $reflect = new ReflectionObject($this); foreach ($reflect->getProperties(ReflectionProperty::IS_PUBLIC + ReflectionProperty::IS_PROTECTED) as $prop) { print $prop->getName() . "\n"; } } } $foo = new Foo(); $foo->listProperties(); ?> will output: alpha beta ---- Server IP: 208.69.120.35 Probable Submitter: 64.81.66.123 ---- Manual Page -- http://www.php.net/manual/en/reflectionclass.getproperties.php Edit -- https://master.php.net/note/edit/93984 Del: integrated -- https://master.php.net/note/delete/93984/integrated Del: useless -- https://master.php.net/note/delete/93984/useless Del: bad code -- https://master.php.net/note/delete/93984/bad+code Del: spam -- https://master.php.net/note/delete/93984/spam Del: non-english -- https://master.php.net/note/delete/93984/non-english Del: in docs -- https://master.php.net/note/delete/93984/in+docs Del: other reasons-- https://master.php.net/note/delete/93984 Reject -- https://master.php.net/note/reject/93984 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161610) next »