Re: parse_ini_file

From: Date: Wed, 07 Jul 2004 08:25:24 +0000
Subject: Re: parse_ini_file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-189851@lists.php.net to get a copy of this message
I'd prefer the text file. It's easier to open that and change values plus they don't have to worry about PHP syntax as much. Haven't tried, but you should be able to import them as private variables for your class...
Thanks for the advice John. OK, so extending this a bit: would it be better to have one ini file per class, or combine class settings into one "master" ini file? By the way, if any else is interested you *can* import these values as private variables. Probably the easiest way might be like this: <?php class usesIniFile { private $_iniFile = 'path/to/file.ini'; private $_secretProps = array(); function __construct($args) {
    // do stuff with $args
    $this->_parseIniFile();
} private function _parseIniFile() {
    $this->_secretProps = parse_ini_file();
} } ?>

« previous php.general (#189851) next »