PHP7 – PHP Constants Containing Arrays

You can define a constant by using the define() function or by using the const keyword outside a class definition as of PHP 5.3.0. Once a constant is defined, it can never be changed or undefined.

Only scalar data (Boolean, integer, float and string) can be contained in constants prior to PHP 5.6. The ability to define array constants and define a constant as a scalar expression was introduced in PHP 5.6 using the const keyword. This ability has now been applied to the define() function too in the PHP7.It is possible to define constants as a resource, but it should be avoided, as it can cause unexpected results.

If you want to get all defined constants list you can use get_defined_constants()

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.