« ReflectionClass::getProperties
ReflectionClass::getReflectionConstant »

ReflectionClass::getProperty

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getProperty — クラスのプロパティを表す ReflectionProperty を取得する

説明

public function ReflectionClass::getProperty(string $name): ReflectionProperty

クラスのプロパティを表す ReflectionProperty を取得します。

パラメータ

name

プロパティの名前。

戻り値

ReflectionProperty を返します。

例

例1 ReflectionClass::getProperty() の基本的な使用例

<?php
$class = new ReflectionClass('ReflectionClass');
$property = $class->getProperty('name');
var_dump($property);
?>

上の例の出力は以下となります。

object(ReflectionProperty)#2 (2) {
  ["name"]=>
  string(4) "name"
  ["class"]=>
  string(15) "ReflectionClass"
}

参考

関連キーワード:
ReflectionClass   ReflectionProperty   プロパティ   getProperty   getProperties   property   getReflectionConstant   基本的   dump   参考
関連する関数・ページ:
reflectionclass.getproperties   reflectionclass.getparentclass   reflectionclass.setstaticpropertyvalue   reflectionproperty.getvalue   reflectionproperty.getdeclaringclass   reflectionclass.getstaticproperties