ReflectionClass::getProperty

(PHP 5, PHP 7)
Gets a ReflectionProperty for a class's property
public ReflectionProperty ReflectionClass::getProperty ( string $name )

Gets a ReflectionProperty for a class's property.

Parameters:
name

The property name.

Returns:

A ReflectionProperty.

Examples:
Basic usage of ReflectionClass::getProperty()
<?php
$class = new ReflectionClass('ReflectionClass');
$property = $class->getProperty('name');
var_dump($property);
?>

The above example will output:

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

ReflectionClass::getProperties() -

doc_php
2016-02-24 16:13:22
Comments
Leave a Comment

Please login to continue.