php8.5
Home/ Manual/ reflection / reflectionclass/ ReflectionClass::getConstants

ReflectionClass::getConstants

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Gets constants

Description

ReflectionClass::getConstants(int|null $filter = null): array

Gets all defined constants from a class, regardless of their visibility.

Parameters

filter

The optional filter, for filtering desired constant visibilities. It's configured using the ReflectionClassConstant constants, and defaults to all constant visibilities.

Return Values

An array of constants, where the keys hold the name and the values the value of the constants.

Changelog

VersionDescription
8.0.0filter has been added.

See Also

  • ReflectionClass::getConstant

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