PHP

How to fetch class constants in PHP

Deep
Written by Deep

Hi Tech Nerds, 

Here are  some tips that came from the problem that I faced in CakePHP. Actually I needed to fetch all constnats of a class. Basically it uses concept of “ReflectionClass” (that is predefined in PHP). I described my function as:

You need to just pass the class PATH to this function as

This will result an associative Array.

Leave a Comment