PHP 5: const vs static
In PHP 5, what is the difference between using const
and static
?
In PHP 5, what is the difference between using const
and static
?
I have been trying to figure out the best way to use bitmask or bitfields in PHP for a long time now for different areas of my application for different user settings and permissions. The farthest I have come so far is from a class contributed by svens in the Stack Overflow
post Bitmask in PHP for settings?. I have slightly modified it below, changing it to use class constants instead of DEFINE and making sure the get method is passed an int only. I also have some sample code to test the class’s functionality below.
I’m just trying to streamline one of my classes and have introduced some functionality in the same style as the flyweight design pattern.