ReflectionClass
PHP Manual

ReflectionClass::getProperty

(PHP 5, PHP 7)

ReflectionClass::getPropertyGets a ReflectionProperty for a class's property

Descrição

public ReflectionProperty ReflectionClass::getProperty ( string $name )

Gets a ReflectionProperty for a class's property.

Parâmetros

name

The property name.

Valor Retornado

A ReflectionProperty.

Exemplos

Exemplo #1 Basic usage of ReflectionClass::getProperty()

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

O exemplo acima irá imprimir:

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

Veja Também


ReflectionClass
PHP Manual