ToonMariner Posted June 22, 2007 Share Posted June 22, 2007 Hi all, I have been looking at some code for a chaps site (ober has too) and had a question. The particular site has a config file and uses parse_ini_file to grab all the variable/value pairs then loops through and creates a constant for them all. I personally have config files that are simply a set of define statements to set constants and their values. Not with standing the fact that and extra level of processing is involved what is the benefit of the parse_ini_file and subsequent define method? Quote Link to comment https://forums.phpfreaks.com/topic/56677-config-files/ Share on other sites More sharing options...
corbin Posted June 22, 2007 Share Posted June 22, 2007 Umm it's 4AM so maybe I missed something, but what's the question? Quote Link to comment https://forums.phpfreaks.com/topic/56677-config-files/#findComment-279982 Share on other sites More sharing options...
ToonMariner Posted June 22, 2007 Author Share Posted June 22, 2007 err if you read the last line it says what is the benefit of the parse_ini_file and subsequent define method? I suppose I should add 'over just defining constants...' MY config files look liek this <?php define('DBHOST' , 'localhost'); // db server. define('DBNAME' , 'xyz'); // database name. ... define('INCLUDEDIR', '/includes/'); ?> the method I have seen in this other code has a config.ini file very similar to php.ini in structure the code uses parse_ini_file(); then takes all the parameters form that and loops through each and defines a constant with the parameter name and assigins its value. Just wanted to know why you would use a .ini file and then use define on all parameters when you could simply use a file full of define staements in the first place. Quote Link to comment https://forums.phpfreaks.com/topic/56677-config-files/#findComment-280050 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.