class MyClass { final public function finalMethod() { // function definition } } $refMethod = new ReflectionMethod('MyClass', 'finalMethod'); if ($refMethod->isFinal()) { echo "Method is final"; } else { echo "Method is not final"; }In this example, we have defined a class "MyClass" with a final method "finalMethod". We then create an instance of the ReflectionMethod class to reflect on this method and check if it is final. The output will be "Method is final" since we marked the method as final. This code example uses the "ReflectionMethod" class and is included in the core PHP library.