Prefixes are used for namespace characters. For instance. since constants are declared in the global scope, you can use the prefix to indicate its context and avoid colliding with another use of the character in a different context.
Since class constants already exist in context (class), there is no need to prefix it further. Instead of your example, this will probably make more sense:
class Input { const STRING = 'string'; const INTEGER = 'integer'; const FLOAT = 'float'; }
However, I find that constants (class or global) are generally not what I use a lot in PHP. You can usually replace a constant with a more specific method name, and this usually makes the code more convenient to maintain. For example, instead of something like this:
$foo->addParameter("foo", Input::STRING);
You can do it:
$foo->addStringParameter("foo");
Easier to read and easier to write.
source share