note 93666 added to function.ini-get-all
| From: | anbert at vip dot qq dot com | Date: | Tue, 22 Sep 2009 11:23:06 +0000 |
| Subject: | note 93666 added to function.ini-get-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160917@lists.php.net to get a copy of this message | ||
<?php
function ini_get_array($full_path_filename){
$config = array();
$content = file_get_contents($full_path_filename);
if (!$content){
return $config;
}
$section = '';
$arr = explode("\r\n", $content);
for ($i=0; $i<sizeof($arr); $i++){
$arr[$i] = trim($arr[$i]);
if (empty($arr[$i])){ continue; }
if ($arr[$i]{0} == ';' || $arr[$i]{0} == '#'){ //comments
continue;
}else if ($arr[$i]{0} == '[' && substr($arr[$i], -1)==']'){
$section = substr($arr[$i], 1, strlen($arr[$i]) - 2);
}else{
$record = explode( "=", $arr[$i] );
if (!empty($record[1])){
$tmp = explode( ";", $record[1] );
$record[1] = $tmp[0];
}
$record[0] = trim($record[0]); $record[1] = trim($record[1]);
if (empty($section)){
$config [$record[0]] = $record[1];
}else{
$config [$section][$record[0]] = $record[1];
}
}
}
return $config;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 58.246.43.162
----
Manual Page -- http://www.php.net/manual/en/function.ini-get-all.php
Edit -- https://master.php.net/note/edit/93666
Del: integrated -- https://master.php.net/note/delete/93666/integrated
Del: useless -- https://master.php.net/note/delete/93666/useless
Del: bad code -- https://master.php.net/note/delete/93666/bad+code
Del: spam -- https://master.php.net/note/delete/93666/spam
Del: non-english -- https://master.php.net/note/delete/93666/non-english
Del: in docs -- https://master.php.net/note/delete/93666/in+docs
Del: other reasons-- https://master.php.net/note/delete/93666
Reject -- https://master.php.net/note/reject/93666
Search -- https://master.php.net/manage/user-notes.php