PHP 8.5.0 Alpha 4 available for testing

ReflectionConstant::getValue

(PHP 8 >= 8.4.0)

ReflectionConstant::getValue値を取得する

説明

public ReflectionConstant::getValue(): mixed

定数の値を取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

定数の値を返します。

例1 ReflectionProperty::getValue() の例

<?php
const FOO = 'foo';

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

上の例の出力は以下となります。

string(3) "foo"
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top