开发者

How to check whether a method is static in PHP?

开发者 https://www.devze.com 2023-04-06 21:16 出处:网络
I need to know whether the method is declared as static given its nam开发者_JS百科e and the name of the class containing it. method_exists provides true for both static and non-static methods. Here\'s

I need to know whether the method is declared as static given its nam开发者_JS百科e and the name of the class containing it. method_exists provides true for both static and non-static methods.


Here's a little more clear way on how to use ReflectionMethod:

$MethodChecker = new ReflectionMethod($ClassName,$MethodName);
var_dump($MethodChecker->isStatic());


use ReflectionMethod::isStatic

0

精彩评论

暂无评论...
验证码 换一张
取 消