note 115385 added to reflectionclass.getconstants
| From: | davide dot renzi at gmail dot com | Date: | Wed, 16 Jul 2014 11:21:18 +0000 |
| Subject: | note 115385 added to reflectionclass.getconstants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199941@lists.php.net to get a copy of this message | ||
If you want to return the constants defined inside a class then you can also define an internal
method as follows:
<?php
class myClass {
const NONE = 0;
const REQUEST = 100;
const AUTH = 101;
// others...
static function getConstants() {
$oClass = new ReflectionClass(__CLASS__);
return $oClass->getConstants();
}
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 2.231.180.148
----
Manual Page -- http://php.net/manual/en/reflectionclass.getconstants.php
Edit -- https://master.php.net/note/edit/115385
Del: integrated -- https://master.php.net/note/delete/115385/integrated
Del: useless -- https://master.php.net/note/delete/115385/useless
Del: bad code -- https://master.php.net/note/delete/115385/bad+code
Del: spam -- https://master.php.net/note/delete/115385/spam
Del: non-english -- https://master.php.net/note/delete/115385/non-english
Del: in docs -- https://master.php.net/note/delete/115385/in+docs
Del: other reasons-- https://master.php.net/note/delete/115385
Reject -- https://master.php.net/note/reject/115385
Search -- https://master.php.net/manage/user-notes.php