PHPIni (.ini)

Background & Context

    • Configuration file format.
    • Associates keys to values.
    • Gathers elements into sections.
    • Can represent PHP expressions such as arrays or maps.
    • Configuration format for PHP application servers.
    • Plain text format.

Import & Export

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Data"data as an association
    "DataRules"data as a list of rules
    "CommentedData"data as a list of sections as rules, comments as strings, and values as associations
  • The "PHPIni" format exports elements of an association or a list.
  • "PHPIni" treats an association as a list of sections. The keys specify the section names; the values specify the elements of a section as associations.
  • Lists in the Wolfram Language are represented in PHPIni as PHP arrays.
  • Associations in the Wolfram Language are represented in PHPIni as PHP maps.
  • The PHP symbols "On", "True" and "Yes" are imported as True. The PHP symbols "Off", "False" and "No" are imported as False.
  • "PHPIni" accepts lists containing a mixture of rules and strings. Rules are exported as sections; strings are exported as commented lines.
  • A commented line starts with ";".
  • Elements declared before the first section are associated with the key None.
  • "CommentedData" preserves inline comments; other data representations discard them.

Examples

Basic Examples  (9)

Export an association as a section with properties:

Create a file:

Add a section and an element to it:

Import it as a PHPIni file:

Create a file:

Write properties and comments to it:

Import the data only, as an Association:

Import the data and the commented lines:

If no section was defined, elements are associated to the key None:

PHPIni represents lists as a PHP array:

PHPIni represents associations as a PHP map:

Sections must start with the character "[" and finish with "]":

Commented lines must start with the character ";":

Arbitrary expressions are converted to strings:

It is possible to build a PHPIni configuration file with commented elements: