array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'reflectionmethod.getprototype.php', 1 => 'ReflectionMethod::getPrototype', 2 => 'Gets the method prototype (if there is one)', ), 'up' => array ( 0 => 'class.reflectionmethod.php', 1 => 'ReflectionMethod', ), 'prev' => array ( 0 => 'reflectionmethod.getmodifiers.php', 1 => 'ReflectionMethod::getModifiers', ), 'next' => array ( 0 => 'reflectionmethod.hasprototype.php', 1 => 'ReflectionMethod::hasPrototype', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionmethod/getprototype.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ReflectionMethod::getPrototype

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

ReflectionMethod::getPrototypeGets the method prototype (if there is one)

Опис

public ReflectionMethod::getPrototype(): ReflectionMethod

Returns the methods prototype.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

A ReflectionMethod instance of the method prototype.

Помилки/виключення

A ReflectionException exception is thrown if the method does not have a prototype.

Приклади

Приклад #1 ReflectionMethod::getPrototype() example

<?php
class Hello {

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

}
class
HelloWorld extends Hello {

public function
sayHelloTo($name) {
return
'Hello world: ' . $name;
}

}

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

Поданий вище приклад виведе:

object(ReflectionMethod)#2 (2) {
  ["name"]=>
  string(10) "sayHelloTo"
  ["class"]=>
  string(5) "Hello"
}

Прогляньте також