php8.5
Home/ Manual/ reflection / reflectionconstant/ ReflectionConstant::getExtension

ReflectionConstant::getExtension

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Gets ReflectionExtension of the defining extension

Description

ReflectionConstant::getExtension(): ReflectionExtension|null

Gets a ReflectionExtension object for the extension which defined the constant.

Parameters Parameters

Return Values

A ReflectionExtension object representing the extension which defined the constant, or null for user-defined constants.

Examples

Basic usage of ReflectionConstant::getExtension

php
<?php
var_dump((new ReflectionConstant('SQLITE3_TEXT'))->getExtension());
?>

The above example will output:

output
object(ReflectionExtension)#2 (1) {
  ["name"]=>
  string(7) "sqlite3"
}

See Also

  • ReflectionConstant::getExtensionName

Source: reference/reflection/reflectionconstant/getextension.xml · from the official PHP manual (php/doc-en)