note 17998 added to function.parse-ini-file

From: Date: Mon, 07 Jan 2002 00:15:12 +0000
Subject: note 17998 added to function.parse-ini-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-24470@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/ -- http://www.php.net/manual/en/function.parse-ini-file.php http://master.php.net/manage/user-notes.php?action=edit+17998 http://master.php.net/manage/user-notes.php?action=delete+17998 http://master.php.net/manage/user-notes.php?action=reject+17998

« previous php.notes (#24470) next »