Table of Contents

ini_get_array

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Get a group of parameters from an INI file as an array

Description

array ini_get_array ( string $filename [, string $section ] )

This function reads multiple configuration key/value pairs from an INI file.

Parameters

$filename: Full path and name of the INI file

$section: Optional, name of the section inside the INI file

Return Values

If a section is specified: a single-dimensional array, with all key/value pairs in the section.

If a section is not specified: a two-dimensional array containing the entire INI file. The first dimension will contain the sections and the second the key/value pairs.

Example

Given that the file /ini_get_array_example.ini contains:

[settings]
name=John
age=33

… this code will read the entire INI file into $arr and display the contents:

<pre><?
  $arr=ini_get_array("/ini_get_array_example.ini");
  print_r($arr);
?></pre>

… and the output will be:

[$arr] = Array (
[settings] = Array (
    (string) [name] => John
    (int) [age] => 33
)
) 

See Also

ini_get() - Get a value from an INI file

ini_put_array() - Write a group of parameters to an INI file from an array

ini_set() - Set a value in an INI file