« ReflectionClass::getConstant
ReflectionClass::getConstructor »

ReflectionClass::getConstants

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getConstants — 定数を取得する

説明

public function ReflectionClass::getConstants(?int $filter = null): array

アクセス権にかかわらず、クラスで定義されているすべての定数を取得します。

パラメータ

filter

オプションのフィルタで、取得したい定数の型を絞り込みます。 ReflectionClassConstant クラスの定数 で設定し、デフォルトではすべての定数を取得します。

戻り値

定数の配列を返します。 キーは名前を保持し、値は定数の値を保持します。

変更履歴

バージョン 説明
8.0.0 filter が追加されました。

参考

関連キーワード:
定数   ReflectionClass   getConstants   filter   getConstant   保持   getConstructor   アクセス権   フィルタ   ReflectionClassConstant   キー   履歴   参考
関連する関数・ページ:
reflectionclass.getconstant   reflectionclass.getreflectionconstants   reflectionclass.getreflectionconstant   reflectionclass.getparentclass   reflectionclass.hasconstant   reflectionclass.getconstructor