application/libraries/CSVReader.php
/** maximum row size to be used for decoding */
maximum row size to be used for decoding
maximum row size to be used for decoding
function parse_file($p_Filepath) {
        $file = fopen($p_Filepath, 'r');
        $this->fields = fgetcsv($file, $this->max_row_size, $this->separator, $this->enclosure);
        $keys = str_getcsv($this->fields[0]);
        $i = 1;
        while (($row = fgetcsv($file, $this->max_row_size, $this->separator, $this->enclosure)) != false) {
            if ($row != null) { 
                $values = str_getcsv($row[0]);
                if (count($keys) == count($values)) {
                    $arr = array();
                    for ($j = 0; $j < count($keys); $j++) {
                        if ($keys[$j] != "") {
                            $arr[$keys[$j]] = $values[$j];
                        }
                    }
                    $content[$i] = $arr;
                    $i++;
                }
            }
        }
        fclose($file);
        return $content;
    }
function parse_file ( $ p_Filepath ) { $ file = fopen ( $ p_Filepath , 'r' ) ; $ this -> fields = fgetcsv ( $ file , $ this -> max_row_size , $ this -> separator , $ this -> enclosure ) ; $ keys = str_getcsv ( $ this -> fields [ 0 ] ) ; $ i = 1 ; while ( ( $ row = fgetcsv ( $ file , $ this -> max_row_size , $ this -> separator , $ this -> enclosure ) ) != false ) { if ( $ row != null ) { $ values = str_getcsv ( $ row [ 0 ] ) ; if ( count ( $ keys ) == count ( $ values ) ) { $ arr = array ( ) ; for ( $ j = 0 ; $ j < count ( $ keys ) ; $ j ++ ) { if ( $ keys [ $ j ] != " " ) { $ arr [ $ keys [ $ j ] ] = $ values [ $ j ] ; } } $ content [ $ i ] = $ arr ; $ i ++ ; } } } fclose ( $ file ) ; return $ content ; }
maximum row size to be used for decoding
maximum row size to be used for decoding
// skip empty lines