If you need this function very badly, you can write a little code using relfection, which will find all the constants and their values. It then sets them inside a variable of type $ CONSTANTS ['CONSTANT_NAME'] ... then that would mean if you wanted to put a constant in a string that you can use {}. Also, instead of adding them to $ CONSTANTS, make it a class that implements arrayaccess, so that you can ensure that the values ββin it cannot be changed in any way (only new elements are added to the object to which you can get access as an array).
So using this would look like this:
$CONSTANTS = new constant_collection();
To make it so that you only have a few extra characters, you could just use $ C instead of $ CONSTANTS;)
Hope this helps, Scott
Scott source share