note 48863 deleted from function.parse-ini-file by danbrown
| From: | danbrown@php.net | Date: | Sun, 23 Jan 2011 17:16:29 +0000 |
| Subject: | note 48863 deleted from function.parse-ini-file by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176175@lists.php.net to get a copy of this message | ||
Note Submitter: georg at linux dot ee
----
<?php
/**
* Function to create lower-case key references to parse_ini_file() 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) {
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 */
?>