note 41907 added to function.parse-ini-file
| From: | mjwilco at yahoo dot com | Date: | Sun, 25 Apr 2004 19:51:17 +0000 |
| Subject: | note 41907 added to function.parse-ini-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68802@lists.php.net to get a copy of this message | ||
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;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.parse-ini-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41907
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41907&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41907&report=yes
Search -- http://master.php.net/manage/user-notes.php