class Test { public static function method1() { // Code for static method } public function method2() { // Code for non-static method } }
$reflectionMethod = new ReflectionMethod('Test', 'method1'); if ($reflectionMethod->isStatic()) { echo "method1 is static"; } else { echo "method1 is non-static"; }In this example, the ReflectionMethod isStatic method returns true as 'method1' is a static method. Package Library: Reflection Method is a part of the PHP Reflection Library which is a built-in package in PHP.