PHP Classes


Recommend this page to a friend!
  Classes of Daniel Jšnecke  >  PHP INI Class  >  README  >  Download  
Role: Documentation
Content type: text/plain
Description: readme
Class: PHP INI Class
Handle ini files and defaults
Author: By
Last change: just some typos
Date: 19 years ago
Size: 2,225 bytes


Class file image Download

Version:     0.2 beta
Author:      Daniel Jaenecke <>
PHP-Version: 4.2.3

    This class is still beta. It should work fine when used as described below,
    butt here is no real error-handling yet nor hast here been much testing. So
    just be aware...

    Handle ini files :)

You can simply use this class to read an ini-file and return as an array - just
like parse_ini_file() does.
But his class can do some more...


    Handling default values
        You can load an additional defaults-file. Whenever you request an 
        ini-value which is not set but available from the defaults it will be 
        returned from there.

    Parsing of constants
        When using parse_ini_file() any value which represents a defined 
        constants name is replaced by the according value - which can be quite 
        useful, but is not always desired - and it cannot be turned off. 
        the ini.class offers this as a feature. You can control the replacement 
        by setting $parse_constants to TRUE/FALSE. Also, any value enclosed in 
        single or double quotes will not be replaced by a constant's value, 
        ignoring the setting of $parse_constants.
Syntax of ini/default files
        Comments start with # or //. Anything to the end of line is ignored.
        Empty lines are also ignored.
    Key-/Value pairs
        Assigning values to a key is done like

            key = value
        to prevent value from being replaced by the value of a constant with
        the same name you can enclose value in single or double quotes:
            key = "value"
            key = 'value'
        Since quotes are removed if they enclose a value you have to use them 
        twice if they are desired, like 
            key = ""value""
        Sections are enclosed into [ ]. Any section containing no key/value-pair
        is ignored.
    Anything else
        Any line not matching one of the patterns for section or key/value will
        be ignored. There is no error-handling yet!
For more information send a message to info at phpclasses dot org.