Hi,
I want to use some kind of data structure in PHP (5.2), mainly in order to not pollute the global namespace. I think about two approaches, using an array or a class. Could you tell me which approach is better ?
Also, the main purpose would be for storing configurations constants.
Thanks
$SQL_PARAMETERS = array (
'server' => '127.0.0.1',
'login' => 'root');
class SqlParameters {
const SERVER = '127.0.0.1';
const LOGIN = 'root';
}
echo $SQL_PARAMETERS['server'];
echo SqlParameters::SERVER;