note 126776 added to function.get-defined-constants
| From: | S-Tian at main dot php dot net | Date: | Tue, 18 Jan 2022 22:31:13 +0000 |
| Subject: | note 126776 added to function.get-defined-constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217512@lists.php.net to get a copy of this message | ||
If you want to create a static method that you can copy and paste into each class you have constants
created, you can use:
<php
public static function get_class_constants(): array
{
$reflect = new ReflectionClass(self::class);
return $reflect->getConstants();
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 2803:c180:2102:29de:c53d:5c71:9160:d6ff)
----
Manual Page -- https://php.net/manual/en/function.get-defined-constants.php
Edit -- https://main.php.net/note/edit/126776
Del: integrated -- https://main.php.net/note/delete/126776/integrated
Del: useless -- https://main.php.net/note/delete/126776/useless
Del: bad code -- https://main.php.net/note/delete/126776/bad+code
Del: spam -- https://main.php.net/note/delete/126776/spam
Del: non-english -- https://main.php.net/note/delete/126776/non-english
Del: in docs -- https://main.php.net/note/delete/126776/in+docs
Del: other reasons-- https://main.php.net/note/delete/126776
Reject -- https://main.php.net/note/reject/126776
Search -- https://main.php.net/manage/user-notes.php