src/FS/File/CSV/Writer.php
public function write( $data, $headers = array() )
	{
		$output = array();
		if( $headers )
		{
			$output[] = implode( $this->separator, $headers );
		}
		foreach( $data as $line )
		{
			foreach( $line as $nr => $value )														//  iterate line values
				if( substr_count( $value, $this->separator ) > 0 )									//  separator found in value
					if( substr( $value, 0, 1 ).substr( $value, -1 ) != '""' )						//  value is not masked
						$line[$nr]	= '"'.addslashes( $value ).'"';									//  mask value
			$line = implode( $this->separator, $line );
			$output[] = $line;
		}
		$file	= new FS_File_Writer( $this->fileName );
		return $file->writeArray( $output );
	}
public function write( $data, $headers = array() )
	{
		$output = array();
		if( $headers )
		{
			$output[] = implode( $this->separator, $headers );
		}
		foreach( $data as $line )
		{
			foreach( $line as $nr => $value )														//  iterate line values
				if( substr_count( $value, $this->separator ) > 0 )									//  separator found in value
					if( substr( $value, 0, 1 ).substr( $value, -1 ) != '""' )						//  value is not masked
						$line[$nr]	= '"'.addslashes( $value ).'"';									//  mask value
			$line = implode( $this->separator, $line );
			$output[] = $line;
		}
		$file	= new FS_File_Writer( $this->fileName );
		return $file->writeArray( $output );
	}
public function write ( $ data , $ headers = array ( ) ) { $ output = array ( ) ; if ( $ headers ) { $ output [ ] = implode ( $ this -> separator , $ headers ) ; } foreach ( $ data as $ line ) { foreach ( $ line as $ nr => $ value ) //  iterate line values
 if ( substr_count ( $ value , $ this -> separator ) > 0 ) //  separator found in value
 if ( substr ( $ value , 0 , 1 ) . substr ( $ value , - 1 ) != '""' ) //  value is not masked
 $ line [ $ nr ] = '"' . addslashes ( $ value ) . '"' ; //  mask value
 $ line = implode ( $ this -> separator , $ line ) ; $ output [ ] = $ line ; } $ file = new FS_File_Writer ( $ this -> fileName ) ; return $ file -> writeArray ( $ output ) ; }
Saves an 2 dimensional array with or without column headers.
@access		public
@param		array		$data			2 dimensional array of data
@param		array		$headers		List of Column Headers
@return		bool
Saves an 2 dimensional array with or without column headers .