lib/IniReader.php
protected function parse($lines)
    {
        $this->content = array(0 => array());
        $currentSection = 0;
        $multiline = false;
        $currentValue = null;

        $arrayContents = array();

        foreach ($lines as $num => $line) {
            if ($multiline) {
                if (preg_match('/^(.*)"\s*$/', $line, $m)) {
                    $currentValue[2] .= $m[1];
                    $multiline = false;
                    $this->content[$currentSection][] = $currentValue;
                } else {
                    $currentValue[2] .= $line."\n";
                }
            } elseif (preg_match('/^\s*([\\w0-9_.\\-]+)(\\[[^\\[\\]]*\\])?\s*=\s*(")?([^"]*)(")?(\s*)/ui', $line, $m)) {
                list($all, $name, $foundkey, $firstquote, $value, $secondquote, $lastspace) = $m;

                if ($foundkey != '') {
                    $key = substr($foundkey, 1, -1);
                    if ($key == '') {
                        if (isset($arrayContents[$currentSection][$name])) {
                            $key = count($arrayContents[$currentSection][$name]);
                        } else {
                            $key = 0;
                        }
                    }
                    $currentValue = array(self::TK_ARR_VALUE, $name, $value, $key);
                    $arrayContents[$currentSection][$name][$key] = $value;
                } else {
                    $currentValue = array(self::TK_VALUE, $name, $value);
                }

                if ($firstquote == '"' && $secondquote == '') {
                    $multiline = true;
                    $currentValue[2] .= "\n";
                } else {
                    if ($firstquote == '' && $secondquote == '') {
                        $currentValue[2] = trim($value);
                    }
                    $this->content[$currentSection][] = $currentValue;
                }
            } elseif (preg_match('/^(\\s*;.*)$/', $line, $m)) {
                $this->content[$currentSection][] = array(self::TK_COMMENT, $m[1]);
            } elseif (preg_match('/^(\\s*\\[([^\\]]+)\\]\\s*)/ui', $line, $m)) {
                if (strpos($m[2], ';')) {
                    // ';' is forbidden in the name as it begins a comment
                    throw new IniSyntaxException("Invalid syntax for the section name: \"".$m[2].'"');
                }
                $currentSection = $m[2];
                $this->content[$currentSection] = array(
                    array(self::TK_SECTION, $m[1]),
                );
            } else {
                $this->content[$currentSection][] = array(self::TK_WS, $line);
            }
        }
    }
protected function parse($lines)
    {
        $this->content = array(0 => array());
        $currentSection = 0;
        $multiline = false;
        $currentValue = null;

        $arrayContents = array();

        foreach ($lines as $num => $line) {
            if ($multiline) {
                if (preg_match('/^(.*)"\s*$/', $line, $m)) {
                    $currentValue[2] .= $m[1];
                    $multiline = false;
                    $this->content[$currentSection][] = $currentValue;
                } else {
                    $currentValue[2] .= $line."\n";
                }
            } elseif (preg_match('/^\s*([\\w0-9_.\\-]+)(\\[[^\\[\\]]*\\])?\s*=\s*(")?([^"]*)(")?(\s*)/ui', $line, $m)) {
                list($all, $name, $foundkey, $firstquote, $value, $secondquote, $lastspace) = $m;

                if ($foundkey != '') {
                    $key = substr($foundkey, 1, -1);
                    if ($key == '') {
                        if (isset($arrayContents[$currentSection][$name])) {
                            $key = count($arrayContents[$currentSection][$name]);
                        } else {
                            $key = 0;
                        }
                    }
                    $currentValue = array(self::TK_ARR_VALUE, $name, $value, $key);
                    $arrayContents[$currentSection][$name][$key] = $value;
                } else {
                    $currentValue = array(self::TK_VALUE, $name, $value);
                }

                if ($firstquote == '"' && $secondquote == '') {
                    $multiline = true;
                    $currentValue[2] .= "\n";
                } else {
                    if ($firstquote == '' && $secondquote == '') {
                        $currentValue[2] = trim($value);
                    }
                    $this->content[$currentSection][] = $currentValue;
                }
            } elseif (preg_match('/^(\\s*;.*)$/', $line, $m)) {
                $this->content[$currentSection][] = array(self::TK_COMMENT, $m[1]);
            } elseif (preg_match('/^(\\s*\\[([^\\]]+)\\]\\s*)/ui', $line, $m)) {
                if (strpos($m[2], ';')) {
                    // ';' is forbidden in the name as it begins a comment
                    throw new IniSyntaxException("Invalid syntax for the section name: \"".$m[2].'"');
                }
                $currentSection = $m[2];
                $this->content[$currentSection] = array(
                    array(self::TK_SECTION, $m[1]),
                );
            } else {
                $this->content[$currentSection][] = array(self::TK_WS, $line);
            }
        }
    }
parsed the lines of the ini file.