Re: Add get_object_constants and get_class_constants
| From: | Crypto Compress | Date: | Wed, 27 Feb 2013 14:54:19 +0000 |
| Subject: | Re: Add get_object_constants and get_class_constants | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66270@lists.php.net to get a copy of this message | ||
Hello Mike,
thank you! It is a useful feature to me.
My usecase are checks on defined constants:
e.g. on my Bitmasks i want to check if given position-value is valid for current bitmask: http://3v4l.org/CR2qJ
e.g. in my Exception Handler i check Exception-Codes: if not defined in Exception class, the underlying api may have changed
...
array *get_defined_constants* ([ bool |$categorize|= false ] ) As there is no equivalent function for classes, i like it simply for the sake of completeness too :)To get rid of performance penalty, i mostly hardcode static arrays with all the constants (high maintenance costs!). cryptocompress