ReflectionMethod::__toString

(PHP 5, PHP 7)
Returns the string representation of the Reflection method object.
public string ReflectionMethod::__toString ( void )

Returns the string representation of the Reflection method object.

Returns:

A string representation of this ReflectionMethod instance.

Examples:
ReflectionMethod::__toString() example
1
2
3
4
5
6
7
8
9
10
11
12
<?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:

ReflectionMethod::export() -

__toString() -

doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.