ini_get_array

(FW >= 1.0)

ini_get_array - get a group of parameters from an ini file as an array

Description

array ini_get_array(string filename, [string section])
Reads multiple configuration key/value pairs from an INI file.  If the $section variable is blank, the array will allow load the entire INI file, and the array will be two-dimensional with the first dimension containing the section and the second the key/value pairs.  If section is set, it will be a single dimensional array.
Warning:  loading an entire INI file can be memory intensive and should be avoided if the file has more than just a few elements.  Instead, use ini_get which can work with large files, or consider using NVRAM instead.

Parameters

$filename

full path and filename of ini file.

section

optional section to use

Return Value

array containing keys/values and sections if applicable

Examples

<? 
$arr=array();
$arr['name']='John';
$arr['age']=33;
ini_put_array("/data.ini",$arr,"settings");
/* INI file will contain this:
[settings]
name=John
age=33
*/
$my_arr = ini_get_array("/data.ini");
print_r($my_arr);
/* array contains:
p0 = ARRAY ARRAY settings elements: STRING name => John INT age => 33
*/ ?>