(PHP 5, PHP 7)
ReflectionMethod::__toString — Returns the string representation of the Reflection method object
public ReflectionMethod::__toString ( ) : string
Returns the string representation of the Reflection method object.
This function has no parameters.
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;
?> The above example will output:
Method [ <user> public method sayHelloTo ] {
@@ /var/www/examples/reflection.php 16 - 18
- Parameters [1] {
Parameter #0 [ <required> $name ]
}
}
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/reflectionmethod.tostring.php