ReflectionMethod::__toString

ReflectionMethod::__toString

(PHP 5, PHP 7)

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

Description

public string ReflectionMethod::__toString ( void )

Returns the string representation of the Reflection method object.

Parameters

This function has no parameters.

Return Values

A string representation of this ReflectionMethod instance.

Examples

Example #1 ReflectionMethod::__toString() example

<?php
class HelloWorld {

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

}

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

The above example will output:

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

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

See Also

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/reflectionmethod.tostring.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部