function unparse ( $data = array(), $fields = array(), $append = false , $is_php = false, $delimiter = null) {
		if ( !is_array($data) || empty($data) ) $data = &$this->data;
		if ( !is_array($fields) || empty($fields) ) $fields = &$this->titles;
		if ( $delimiter === null ) $delimiter = $this->delimiter;
		
		$string = ( $is_php ) ? "<?php header('Status: 403'); die(' '); ?>".$this->linefeed : '' ;
		$entry = array();
		
		// create heading
		if ( $this->heading && !$append && !empty($fields) ) {
			foreach( $fields as $key => $value ) {
				$entry[] = $this->_enclose_value($value);
			}
			$string .= implode($delimiter, $entry).$this->linefeed;
			$entry = array();
		}
		
		// create data
		foreach( $data as $key => $row ) {
			foreach( $row as $field => $value ) {
				$entry[] = $this->_enclose_value($value);
			}
			$string .= implode($delimiter, $entry).$this->linefeed;
			$entry = array();
		}
		
		return $string;
	}
function unparse ( $data = array(), $fields = array(), $append = false , $is_php = false, $delimiter = null) {
		if ( !is_array($data) || empty($data) ) $data = &$this->data;
		if ( !is_array($fields) || empty($fields) ) $fields = &$this->titles;
		if ( $delimiter === null ) $delimiter = $this->delimiter;
		
		$string = ( $is_php ) ? "<?php header('Status: 403'); die(' '); ?>".$this->linefeed : '' ;
		$entry = array();
		
		// create heading
		if ( $this->heading && !$append && !empty($fields) ) {
			foreach( $fields as $key => $value ) {
				$entry[] = $this->_enclose_value($value);
			}
			$string .= implode($delimiter, $entry).$this->linefeed;
			$entry = array();
		}
		
		// create data
		foreach( $data as $key => $row ) {
			foreach( $row as $field => $value ) {
				$entry[] = $this->_enclose_value($value);
			}
			$string .= implode($delimiter, $entry).$this->linefeed;
			$entry = array();
		}
		
		return $string;
	}
function unparse ( $ data = array ( ) , $ fields = array ( ) , $ append = false , $ is_php = false , $ delimiter = null ) { if ( ! is_array ( $ data ) || empty ( $ data ) ) $ data = & $ this -> data ; if ( ! is_array ( $ fields ) || empty ( $ fields ) ) $ fields = & $ this -> titles ; if ( $ delimiter === null ) $ delimiter = $ this -> delimiter ; $ string = ( $ is_php ) ? "<?php header('Status: 403'); die(' '); ?>" . $ this -> linefeed : '' ; $ entry = array ( ) ; // create heading if ( $ this -> heading && ! $ append && ! empty ( $ fields ) ) { foreach ( $ fields as $ key => $ value ) { $ entry [ ] = $ this -> _enclose_value ( $ value ) ; } $ string .= implode ( $ delimiter , $ entry ) . $ this -> linefeed ; $ entry = array ( ) ; } // create data foreach ( $ data as $ key => $ row ) { foreach ( $ row as $ field => $ value ) { $ entry [ ] = $ this -> _enclose_value ( $ value ) ; } $ string .= implode ( $ delimiter , $ entry ) . $ this -> linefeed ; $ entry = array ( ) ; } return $ string ; }
Create CSV data from array
@param   data        2D array with data
@param   fields      field names
@param   append      if true, field names will not be output
@param   is_php      if a php die() call should be put on the first
line of the file, this is later ignored when read.
@param   delimiter   field delimiter to use
@return  CSV data (text string)
Create CSV data from array