note 22505 deleted from function.parse-ini-file by sniper
| From: | sniper@php.net | Date: | Thu, 27 Mar 2003 12:28:37 +0000 |
| Subject: | note 22505 deleted from function.parse-ini-file by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-45892@lists.php.net to get a copy of this message | ||
Hi!
I've had the same problems with larger files, also some fields in the ini file were incorrectly
retrieved. I'm using the following bit of code now, does the trick for me...
while(!feof($fp)) {
$line = trim(fgets($fp, 1024));
if($line[0] == "[" && $line[strlen($line) - 1] == "]") {
$sec_name = substr($line, 1, strlen($line) - 2);
}
else {
$pos = strpos($line, "=");
$property = substr($line, 0, $pos);
$value = substr($line, $pos + 1, strlen($line) - $pos - 1);
$ini_array[$sec_name][$property] = $value;
}
}