array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'reflectionclass.getproperty.php', 1 => 'ReflectionClass::getProperty', ), 'up' => array ( 0 => 'class.reflectionclass.php', 1 => 'ReflectionClass', ), 'prev' => array ( 0 => 'reflectionclass.getproperties.php', 1 => 'ReflectionClass::getProperties', ), 'next' => array ( 0 => 'reflectionclass.getreflectionconstant.php', 1 => 'ReflectionClass::getReflectionConstant', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/reflection/reflectionclass/getproperty.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getProperty — クラスのプロパティを表す 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" }