when i had to define constants in PHP i usually set them with the define function. But when i looked at the code of others i often saw the use of a _CONFIG array. And now, with PHP5 there's also the possibility of having a constant class.
So - what's the most beautiful way to define constants for an application now? and why?
// Method 1 - define
define('SERVER_ROOT', 'D:/htdocs/');
define('SERVER_LIB', 'D:/htdocs/lib/');
define('WEB_HOST', 'http://www.trexx.dev/');
// Method 2 - config array
$_CONFIG = Array();
$_CONFIG['server_root'] = 'D:/htdocs/';
$_CONFIG['server_lib'] = 'D:/htdocs/lib';
$_CONFIG['web_host'] = 'http://www.trexx.dev/';
// Method 3 - constant class (php5)
Class Config
{
const SERVER_ROOT = 'D:/htdocs/';
const SERVER_LIB = 'D:/htdocs/lib/';
const WEB_HOST = 'http://www.trexx.dev/';
}