src/FS/File/CSV/Reader.php
public function toAssocArray( $headerMap = array() )
	{
		$data		= array();
		$iterator	= new FS_File_CSV_Iterator( $this->fileName, $this->delimiter );
		$keys		= $this->getColumnHeaders( $headerMap );
		$line		= 0;
		if( $this->withHeaders )
		{
			$iterator->next();
			$line++;
		}
		while( $iterator->valid() )
		{
			$line++;
			$values	= $iterator->current();
			if( count( $keys ) != count( $values ) )
				throw new RuntimeException( 'Invalid line '.$line.' in file "'.$this->fileName.'"' );
			$data[]	= array_combine( $keys, $values );
		}
		return $data;
	}
public function toAssocArray( $headerMap = array() )
	{
		$data		= array();
		$iterator	= new FS_File_CSV_Iterator( $this->fileName, $this->delimiter );
		$keys		= $this->getColumnHeaders( $headerMap );
		$line		= 0;
		if( $this->withHeaders )
		{
			$iterator->next();
			$line++;
		}
		while( $iterator->valid() )
		{
			$line++;
			$values	= $iterator->current();
			if( count( $keys ) != count( $values ) )
				throw new RuntimeException( 'Invalid line '.$line.' in file "'.$this->fileName.'"' );
			$data[]	= array_combine( $keys, $values );
		}
		return $data;
	}
public function toAssocArray ( $ headerMap = array ( ) ) { $ data = array ( ) ; $ iterator = new FS_File_CSV_Iterator ( $ this -> fileName , $ this -> delimiter ) ; $ keys = $ this -> getColumnHeaders ( $ headerMap ) ; $ line = 0 ; if ( $ this -> withHeaders ) { $ iterator -> next ( ) ; $ line ++ ; } while ( $ iterator -> valid ( ) ) { $ line ++ ; $ values = $ iterator -> current ( ) ; if ( count ( $ keys ) != count ( $ values ) ) throw new RuntimeException ( 'Invalid line ' . $ line . ' in file "' . $ this -> fileName . '"' ) ; $ data [ ] = array_combine ( $ keys , $ values ) ; } return $ data ; }
Reads data and returns an associative array if column headers are used.
@access		public
@return		array
Reads data and returns an associative array if column headers are used .