What is the purpose of the Java Constant Pool?

Constant pool is a part of .class file (and its in-memory representation) that contains constants needed to run the code of that class. These constants include literals specified by the programmer and symbolic references generated by compiler. Symbolic references are basically names of classes, methods and fields referenced from the code. These references are used … Read more

Can I get CONST’s defined on a PHP class?

You can use Reflection for this. Note that if you are doing this a lot you may want to looking at caching the result. <?php class Profile { const LABEL_FIRST_NAME = “First Name”; const LABEL_LAST_NAME = “Last Name”; const LABEL_COMPANY_NAME = “Company”; } $refl = new ReflectionClass(‘Profile’); print_r($refl->getConstants()); Output: Array ( ‘LABEL_FIRST_NAME’ => ‘First Name’, … Read more