note 17998 deleted from function.parse-ini-file by sniper

From: Date: Thu, 27 Mar 2003 12:27:22 +0000
Subject: note 17998 deleted from function.parse-ini-file by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-45890@lists.php.net to get a copy of this message
To automate the assignment of settings in the .ini file to variables: $SETTINGS = parse_ini_file("./your.ini.php"); while($key = key($SETTINGS)) { $$key = current($SETTINGS); //variable variables next($SETTINGS); } So, for example, if you had a line: dbtype = mysql then, the above code will create a variable called $dbtype, and thus can be referenced as a regular variable. Also, it is wise to end your .ini file with a .php extension so that it is not displayed as text when called directly through a browser. Brett http://www.brettsbsd.net/

« previous php.notes (#45890) next »