Single-letter prefix for PHP class constants?

Posted by keithjgrant on Stack Overflow See other posts from Stack Overflow or by keithjgrant
Published on 2010-03-19T17:25:30Z Indexed on 2010/03/19 17:31 UTC
Read the original article Hit count: 265

I've noticed many (all?) PHP constants have a single-letter prefix, like E_NOTICE, T_STRING, etc. When defining a set of class constants that work in conjunction with one another, do you prefer to follow similar practice, or do you prefer to be more verbose?

class Foo {
    // let's say 'I' means "input" or some other relevant word
    const I_STRING = 'string';
    const I_INTEGER = 'integer';
    const I_FLOAT = 'float';
}

or

class Bar {
    const INPUT_STRING = 'string';
    const INPUT_INTEGER = 'integer';
    const INPUT_FLOAT = 'float';
}

© Stack Overflow or respective owner

Related posts about php

Related posts about common-practice