ReflectionMethod
PHP 手册

ReflectionMethod::__toString

(PHP 5)

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

说明

public string ReflectionMethod::__toString ( void )

Returns the string representation of the Reflection method object.

参数

此函数没有参数。

返回值

A string representation of this ReflectionMethod instance.

范例

Example #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 ]
  }
}

参见


ReflectionMethod
PHP 手册