ReflectionMethod::__toString
PHP function
Edit on GitHub ✎
(PHP 5, PHP 7, PHP 8)
Returns the string representation of the Reflection method object
Description
ReflectionMethod::__toString(): string
Returns the string representation of the Reflection method object.
Parameters Parameters
Return Values
A string representation of this ReflectionMethod instance.
Examples
ReflectionMethod::__toString example
php
<?php
class HelloWorld {
public function sayHelloTo($name) {
return 'Hello ' . $name;
}
}
$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
echo $reflectionMethod;
?>The above example will output:
output
Method [ <user> public method sayHelloTo ] {
@@ /var/www/examples/reflection.php 16 - 18
- Parameters [1] {
Parameter #0 [ <required> $name ]
}
}See Also
ReflectionMethod::export- __toString()