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

ReflectionConstant::getValue

PHP function Edit on GitHub ✎

(PHP 8 >= 8.4.0)

Gets value

Description

ReflectionConstant::getValue(): mixed

Gets the value of the constant.

Parameters Parameters

Return Values

The value of the constant.

Examples

ReflectionProperty::getValue example

php
<?php
const FOO = 'foo';

var_dump((new \ReflectionConstant('FOO'))->getValue());
?>

The above example will output:

output
string(3) "foo"

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