The value of a constant can’t be reassigned. Constants do not have a
$ before their names, and by convention the names of constants are in uppercase letters. Constants can contain only scalar values (no arrays or objects). Constants have global scope, so they are accessible everywhere in your scripts after they have been defined – even inside functions.
You can create a constants using
define(). Note however that constants are defined in a different way insides classes.
It is best to define your constants in an include file.
There are some constants which are defined by PHP. However, that is the subject of a different post.
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
bool defined ( string $name )
Checks whether the given constant exists and is defined.