ReflectionMethod::__toString

(PHP 5, PHP 7, PHP 8)

ReflectionMethod::__toString返回反射方法對(duì)象的字符串表達(dá)

說明

public ReflectionMethod::__toString(): string

返回反射方法對(duì)象的字符串表達(dá)

參數(shù)

此函數(shù)沒有參數(shù)。

返回值

ReflectionMethod 實(shí)例的字符串表達(dá),也就是字符串

范例

示例 #1 ReflectionMethod::__toString() example

<?php
class HelloWorld {

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

}

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

以上例程會(huì)輸出:

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

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

參見