array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'reflectionmethod.tostring.php', 1 => 'ReflectionMethod::__toString', 2 => 'Returns the string representation of the Reflection method object', ), 'up' => array ( 0 => 'class.reflectionmethod.php', 1 => 'ReflectionMethod', ), 'prev' => array ( 0 => 'reflectionmethod.setaccessible.php', 1 => 'ReflectionMethod::setAccessible', ), 'next' => array ( 0 => 'class.reflectionnamedtype.php', 1 => 'ReflectionNamedType', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionmethod/tostring.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ReflectionMethod::__toString

(PHP 5, PHP 7, PHP 8)

ReflectionMethod::__toStringReturns the string representation of the Reflection method object

Опис

public ReflectionMethod::__toString(): string

Returns the string representation of the Reflection method object.

Параметри

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

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

A string representation of this ReflectionMethod instance.

Приклади

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

<?php
class HelloWorld {

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

}

$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
echo
$reflectionMethod;
?>

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

Method [ <user> public method sayHelloTo ] {
  @@ /var/www/examples/reflection.php 16 - 18

  - Parameters [1] {
    Parameter #0 [ <required> $name ]
  }
}

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