Re: Discussion of method -- config files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2008-06-19 at 17:31 +0300, Sancar Saran wrote:
> Hi tedd
> 
> My final solution was.
> 
> class conf {
> 
> 	public static $vals  = array(); // config array
> ...
> }
> 
> conf::$vals['mysql_host'] = 'localhost';
> conf::$vals['mysql_user'] = "user@localhost";
> 
> you can access anywhere of your script and you won't need to pollute $GLOBALS.

Technically, you've polluted global class namespace with a class called
"conf". I wonder how many others have made a class called conf? Good
thing namespaces are coming along eventually :)

Admittedly though, the class implementation is more robust since it
could pull it's config information from anywhere. However, it's also
less efficient.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux