Re: Discussion of method -- config files

From: Date: Thu, 19 Jun 2008 15:03:55 +0000
Subject: Re: Discussion of method -- config files
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-275602@lists.php.net to get a copy of this message
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

« previous php.general (#275602) next »