PHP: Hypertext Preprocessor (original) (raw)
ReflectionClass::getExtension
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getExtension — Gets a ReflectionExtension object for the extension which defined the class
Description
Parameters
This function has no parameters.
Return Values
A ReflectionExtension object representing the extension which defined the class, or [null](reserved.constants.php#constant.null)
for user-defined classes.
Examples
Example #1 Basic usage of ReflectionClass::getExtension()
<?php $class = new ReflectionClass('ReflectionClass'); <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>e</mi><mi>x</mi><mi>t</mi><mi>e</mi><mi>n</mi><mi>s</mi><mi>i</mi><mi>o</mi><mi>n</mi><mo>=</mo></mrow><annotation encoding="application/x-tex">extension = </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6595em;"></span><span class="mord mathnormal">e</span><span class="mord mathnormal">x</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">s</span><span class="mord mathnormal">i</span><span class="mord mathnormal">o</span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span></span></span></span>class->getExtension(); var_dump($extension); ?>
The above example will output:
object(ReflectionExtension)#2 (1) { ["name"]=> string(10) "Reflection" }
See Also
- ReflectionClass::getExtensionName() - Gets the name of the extension which defined the class