Parse INI file into a multi-dimensional array

PHP's native parse_ini_file function allows you to process simple ini configuration files. As the documentation says "parse_ini_file() loads the ini file specified in filename, and returns the settings in it in an associative array.".

However, the problem with the function is that it will only give you an array of key => value pairs, where key will be a string and value will be a mixed value.

What if you wanted your keys themselves to be structures? For those occasions I have written the Ini_Struct class.

This class allows you to:

  • define multi-dimensional structures
  • group configurations (e.g. production, development, testing, etc.) into separate sections (native INI sections)
  • extend sections from one another
  • override keys of extended sections in extending sections
Showing 1 - 1 of 1 results