function output ($filename = null, $data = array(), $fields = array(), $delimiter = null) {
		if ( empty($filename) ) $filename = $this->output_filename;
		if ( $delimiter === null ) $delimiter = $this->output_delimiter;
		$data = $this->unparse($data, $fields, null, null, $delimiter);
		if ( $filename !== null ) {
			header('Content-type: application/csv');
			header('Content-Disposition: attachment; filename="'.$filename.'"');
			echo $data;
		}
		return $data;
	}
function output ($filename = null, $data = array(), $fields = array(), $delimiter = null) {
		if ( empty($filename) ) $filename = $this->output_filename;
		if ( $delimiter === null ) $delimiter = $this->output_delimiter;
		$data = $this->unparse($data, $fields, null, null, $delimiter);
		if ( $filename !== null ) {
			header('Content-type: application/csv');
			header('Content-Disposition: attachment; filename="'.$filename.'"');
			echo $data;
		}
		return $data;
	}
function output ( $ filename = null , $ data = array ( ) , $ fields = array ( ) , $ delimiter = null ) { if ( empty ( $ filename ) ) $ filename = $ this -> output_filename ; if ( $ delimiter === null ) $ delimiter = $ this -> output_delimiter ; $ data = $ this -> unparse ( $ data , $ fields , null , null , $ delimiter ) ; if ( $ filename !== null ) { header ( 'Content-type: application/csv' ) ; header ( 'Content-Disposition: attachment; filename="' . $ filename . '"' ) ; echo $ data ; } return $ data ; }
Generate CSV based string for output
@param   filename    if specified, headers and data will be output directly to browser as a downloable file
@param   data        2D array with data
@param   fields      field names
@param   delimiter   delimiter used to separate data
@return  CSV data using delimiter of choice, or default
Generate CSV based string for output