Class: Ini

A very simple class that abstracts reading/writing INI data from strings and files.

Usage:

<?php

// Parsing files or strings
$data = Ini::parse ('ini_filename_or_string', true);

// Write a data structure into an INI-formatted string
$ini = Ini::write ($data);

// Write a data structure to an INI-formatted file
$res = Ini::write ($data, 'filename.ini');

?>

Properties

No properties.

Methods

public static parse ($string, $sections = false, $scanner_mode = 0)

Parses an INI-formatted string or file. Just an alias for parse_ini_file/parse_ini_string that's here for completeness and consistency.

public static write ($data, $file = false, $header = false)

Write a data structure to an INI-formatted string or file. Adds "secure" comments to the start and end of the data so you can hide your INI data in files using a .php extension. If a $header is provided, it will add that as a comment to the top of the file.