note 41907 deleted from function.parse-ini-file by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 09 Aug 2004 00:23:28 +0000 |
| Subject: | note 41907 deleted from function.parse-ini-file by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74265@lists.php.net to get a copy of this message | ||
Note Submitter: mjwilco@yahoo.com
----
This is a very simple way to parse through a basic INI file and turn all key/value pairs into
variables. So, an INI file that contains "color = #aabbcc" would make the variable $color
and its value would be #aabbcc. Note the use of variable variables.
<?php
foreach(parse_ini_file('sample.ini') as $key => $value) {
$$key = $value;
}
?>