ReflectionClass
PHP Manual

ReflectionClass::getProperties

(PHP 5)

ReflectionClass::getPropertiesدریافت خاصیت‌ها

Description

public array ReflectionClass::getProperties ([ int $filter ] )

دریافت خاصیت‌های بازتابی.

Warning

This function is currently not documented; only its argument list is available.

Parameters

filter

فیلتر اختیاری برای فیلتر کردن انواع دلخواه فیلتر. با استفاده از ثابت‌های ReflectionProperty و پیش‌فرض‌های تمام خاصیت‌ها تنظیم شده است.

Return Values

آرایه اشیا ReflectionProperty.

Examples

Example #1 مثال فیلترReflectionClass::getProperties()

این مثال استفاده اختیاری از پارامتر filter را نشان می‌دهد که از خاصیت‌های خصوصی استفاده نمی‌کند.

<?php
class Foo {
    public    
$foo  1;
    protected 
$bar  2;
    private   
$baz  3;
}

$foo = new Foo();

$reflect = new ReflectionClass($foo);
$props   $reflect->getProperties(ReflectionProperty::IS_PUBLIC ReflectionProperty::IS_PROTECTED);

foreach (
$props as $prop) {
    print 
$prop->getName() . "\n";
}

var_dump($props);

?>

The above example will output something similar to:

foo
bar
array(2) {
  [0]=>
  object(ReflectionProperty)#3 (2) {
    ["name"]=>
    string(3) "foo"
    ["class"]=>
    string(3) "Foo"
  }
  [1]=>
  object(ReflectionProperty)#4 (2) {
    ["name"]=>
    string(3) "bar"
    ["class"]=>
    string(3) "Foo"
  }
}

See Also


ReflectionClass
PHP Manual