エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント4件
- 注目コメント
- 新着コメント
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
PHPでクラス定数の一覧を取得する - Do You PHP はてブロ
PHP5限定ですが、Reflectionでどうでしょうか? get_defined_constants()やget_class_vars()などでは取... PHP5限定ですが、Reflectionでどうでしょうか? get_defined_constants()やget_class_vars()などでは取得できないので、、無理っぽい。 以下、サンプルです。 $ cat Reflection_getConstants.php <?php class Test { const HOGE = 1; public $hoge = 2; } $class = new ReflectionClass('Test'); var_dump($class->getConstants()); $class = new ReflectionClass('DateTime'); var_dump($class->getConstants()); $ $ php Reflection_getConstants.php array(1) { ["HOGE"]=> int
2012/12/31 リンク