PHP Doku:: Gets declaring class for the reflected method. - reflectionmethod.getdeclaringclass.html

Verlauf / Chronik / History: (2) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzVariablen- und typbezogene ErweiterungenReflectionThe ReflectionMethod classReflectionMethod::getDeclaringClass

Ein Service von Reinhard Neidl - Webprogrammierung.

The ReflectionMethod class

<<ReflectionMethod::export

ReflectionMethod::getModifiers>>

ReflectionMethod::getDeclaringClass

(PHP 5)

ReflectionMethod::getDeclaringClassGets declaring class for the reflected method.

Beschreibung

public ReflectionClass ReflectionMethod::getDeclaringClass ( void )

Gets the declaring class for the reflected method.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

A ReflectionClass object of the class that the reflected method is part of.

Beispiele

Beispiel #1 ReflectionMethod::getDeclaringClass() example

<?php
class HelloWorld {

    protected function 
sayHelloTo($name) {
        return 
'Hello ' $name;
    }

}

$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
var_dump($reflectionMethod->getDeclaringClass());
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

object(ReflectionClass)#2 (1) {
  ["name"]=>
  string(10) "HelloWorld"
}

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)