classes/phing/tasks/ext/inifile/IniFileConfig.php
public function read($file)
    {
        $this->lines = [];

        $section = '';

        foreach (file($file) as $line) {
            if (preg_match('/^\s*(;.*)?$/', $line)) {
                // comment or whitespace
                $this->lines[] = [
                    'type' => 'comment',
                    'data' => $line,
                    'section' => $section
                ];
            } elseif (preg_match('/^\s?\[(.*)\]/', $line, $match)) {
                // section
                $section = $match[1];
                $this->lines[] = [
                    'type' => 'section',
                    'data' => $line,
                    'section' => $section
                ];
            } elseif (preg_match('/^\s*(.*?)\s*=\s*(.*?)\s*$/', $line, $match)) {
                // entry
                $this->lines[] = [
                    'type' => 'entry',
                    'data' => $line,
                    'section' => $section,
                    'key' => $match[1],
                    'value' => $match[2]
                ];
            }
        }
    }
public function read($file)
    {
        $this->lines = [];

        $section = '';

        foreach (file($file) as $line) {
            if (preg_match('/^\s*(;.*)?$/', $line)) {
                // comment or whitespace
                $this->lines[] = [
                    'type' => 'comment',
                    'data' => $line,
                    'section' => $section
                ];
            } elseif (preg_match('/^\s?\[(.*)\]/', $line, $match)) {
                // section
                $section = $match[1];
                $this->lines[] = [
                    'type' => 'section',
                    'data' => $line,
                    'section' => $section
                ];
            } elseif (preg_match('/^\s*(.*?)\s*=\s*(.*?)\s*$/', $line, $match)) {
                // entry
                $this->lines[] = [
                    'type' => 'entry',
                    'data' => $line,
                    'section' => $section,
                    'key' => $match[1],
                    'value' => $match[2]
                ];
            }
        }
    }
public function read ( $ file ) { $ this -> lines = [ ] ; $ section = '' ; foreach ( file ( $ file ) as $ line ) { if ( preg_match ( '/^\s*(;.*)?$/' , $ line ) ) { // comment or whitespace $ this -> lines [ ] = [ 'type' => 'comment' , 'data' => $ line , 'section' => $ section ] ; } elseif ( preg_match ( '/^\s?\[(.*)\]/' , $ line , $ match ) ) { // section $ section = $ match [ 1 ] ; $ this -> lines [ ] = [ 'type' => 'section' , 'data' => $ line , 'section' => $ section ] ; } elseif ( preg_match ( '/^\s*(.*?)\s*=\s*(.*?)\s*$/' , $ line , $ match ) ) { // entry $ this -> lines [ ] = [ 'type' => 'entry' , 'data' => $ line , 'section' => $ section , 'key' => $ match [ 1 ] , 'value' => $ match [ 2 ] ] ; } } }
Read ini file

@param string $file filename

@return void
Read ini file