Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<ReflectionClass::getConstantReflectionClass::getConstructor>
^ReflectionClassLast updated: Mon, 26 Oct 2026

ReflectionClass::getConstants

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getConstants — Gets constants

Description

public function ReflectionClass::getConstants(?int $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

Version Description
8.0.0 filter has been added.

See Also


<ReflectionClass::getConstantReflectionClass::getConstructor>
^ReflectionClassLast updated: Mon, 26 Oct 2026