advanced code snippet search
ryantxr on 07/11/12
class Reflection constants
07/11/12 04:41am
Gets the constants from a class using reflection.
class MyTestClass{ const TESTVAR1 = 1001; const TESTVAR2 = 1002; const TESTSTR1 = 'hello';} $rc = new ReflectionClass('MyTestClass');$v = $rc->getConstants(); asort($v);// sort by value//ksort($v);// sort by key foreach ( $v as $name => $value){ echo "$name => $value\n";}
Report this snippet Tweet
Comment:
You need to login to post a comment.