note 48863 added to function.parse-ini-file
| From: | georg at linux dot ee | Date: | Sun, 09 Jan 2005 22:15:06 +0000 |
| Subject: | note 48863 added to function.parse-ini-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83009@lists.php.net to get a copy of this message | ||
<?php
/**
* Function to create lower-case key references to parse_ini() result.
* Copyright (C) 2005 Joosep-Georg Järvemaa <georg@linux.ee>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Creates lower-case references to configuration array loaded from .INI.
*
* Function uses recursion to dive into configuration sub-sections and
* marks already checked sections with additional key '_ns_ini_lcrefs'.
*
* @param arr Configuration array.
*/
function ns_ini_lcrefs(& $arr) {
$_lc_key = '';
foreach (array_keys($arr) as $_k) {
if (is_array($arr[$_k]) && !isset($arr[$_k]['_ns_ini_lcrefs']))
ns_ini_lcrefs($arr[$_k]);
if (($_lc_k = strtolower($_k)) != $_k)
$arr[$_lc_k] =& $arr[$_k];
}
$arr['_ns_ini_lcrefs'] = true;
} // function ns_ini_lcrefs()
/* EOF */
?>
----
Manual Page -- http://www.php.net/manual/en/function.parse-ini-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48863
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48863&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48863&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48863&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48863&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48863&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48863&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48863&report=yes
Search -- http://master.php.net/manage/user-notes.php