.. _extensions-extreflection: .. _ext-reflection: ext/reflection ++++++++++++++ Extension `Reflection `_. PHP comes with a complete `reflection `_ API that adds the ability to reverse-engineer classes, interfaces, functions, methods and extensions. Additionally, the `reflection `_ API offers ways to retrieve doc comments for functions, classes and methods. .. code-block:: php The %s function '%s''.PHP_EOL. ' declared in %s'.PHP_EOL. ' lines %d to %d'.PHP_EOL, $func->isInternal() ? 'internal' : 'user-defined', $func->getName(), $func->getFileName(), $func->getStartLine(), $func->getEndline() ); // Print documentation comment printf('---> Documentation:'.PHP_EOL.' %s',PHP_EOL, var_export($func->getDocComment(), 1)); // Print static variables if existant if ($statics = $func->getStaticVariables()) { printf('---> Static variables: %s',PHP_EOL, var_export($statics, 1)); } } // Create an instance of the ReflectionFunction class dumpReflectionFunction(new ReflectionFunction('counter1')); dumpReflectionFunction(new ReflectionFunction($counter2)); ?> See also `Reflection `_. Specs _____ +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Extensions/Extreflection | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Appinfo `, :ref:`CE `, :ref:`Changed Behavior ` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+