(PHP 8 >= 8.3.0)
ReflectionMethod::createFromMethodName — 建立新的 ReflectionMethod
method
以 ::
分隔的類別名稱和方法名稱。
成功時會回傳一個新的 ReflectionMethod 物件。
如果指定的 method 不存在,會拋出 ReflectionException。
範例 #1 ReflectionMethod::createFromMethodName() 範例
<?php
class Foo {
public function bar() {
}
}
$methodInfo = ReflectionMethod::createFromMethodName("Foo::bar");
var_dump($methodInfo);
?>
上述範例會輸出:
object(ReflectionMethod)#1 (2) { ["name"]=> string(3) "bar" ["class"]=> string(3) "Foo" }