A constant is like a variable whose value can not be changed. You see, it is constant and doesn’t vary. Attempting to redefine a constant will issue a notice and the value of the constant will not have been changed.

The first parameter of define() is the constant’s name, the second parameter its value. If you pass the third parameter as true, it will not be case sensitive (shown below).

A constant can have a value of only null or a scalar value (integer, float, string, or boolean). Of note here is that it can not be an array.

define("ONE", "apple");
define("TWO", "banana");
define("THREE", "carrot", true);
 
echo ONE; // apple
echo TWO; // banana
echo two; // two (and issues a notice)
echo THREE; // carrot
echo three; // carrot
echo tHrEE; // carrot

It is customary to name constants in all caps but that need not be so. Just remember that by default, the names are case sensitive. Naming restrictions for constants are the same as for variables - alphanumeric and underscores only, and it must not begin with a numeral.

Also, refrain from naming a constant with a double underscore at the front and end (__EXAMPLE__) as that is the format for PHP’s magic constants and may cause a conflict should one with that name be introduced in the future.