splfileobject.fputcsv(3) php man page | unix.com

Man Page: splfileobject.fputcsv

Operating Environment: php

Section: 3

SPLFILEOBJECT.FPUTCSV(3)						 1						  SPLFILEOBJECT.FPUTCSV(3)

SplFileObject::fputcsv - Write a field array as a CSV line

SYNOPSIS
public int SplFileObject::fputcsv (array $fields, [string $delimiter = ","], [string $enclosure = '"'], [string $escape = "
DESCRIPTION
Writes the $fields array to the file as a CSV line.
PARAMETERS
o $fields - An array of values. o $delimiter - The optional $delimiter parameter sets the field delimiter (one character only). o $enclosure - The optional $enclosure parameter sets the field enclosure (one character only). o $escape - The optional $escape parameter sets the escape character (one character only).
RETURN VALUES
Returns the length of the written string or FALSE on failure. Returns FALSE, and does not write the CSV line to the file, if the $delimiter or $enclosure parameter is not a single character.
ERRORS
/EXCEPTIONS An E_WARNING level error is issued if the $delimiter or $enclosure parameter is not a single character.
CHANGELOG
+--------------+-------------------------------+ | Version | | | | | | | Description | | | | +--------------+-------------------------------+ |5.5.21, 5.6.5 | | | | | | | Added the $escape parameter. | | | | +--------------+-------------------------------+
EXAMPLES
Example #1 SplFileObject::fputcsv example <?php $list = array ( array('aaa', 'bbb', 'ccc', 'dddd'), array('123', '456', '789'), array('"aaa"', '"bbb"') ); $file = new SplFileObject('file.csv', 'w'); foreach ($list as $fields) { $file->fputcsv($fields); } ?> The above example will write the following to file.csv: aaa,bbb,ccc,dddd 123,456,789 """aaa""","""bbb"""
SEE ALSO
fputcsv(3), SplFileObject::fgetcsv. PHP Documentation Group SPLFILEOBJECT.FPUTCSV(3)
Related Man Pages
mdb-export(1) - debian
getopt(3) - php
fputcsv(3) - php
splfileinfo(3) - php
splfileobject.fputcsv(3) - php
Similar Topics in the Unix Linux Community
parsing with multible delimiters
how to parse this string
how to get filename from directory
Change specific occurence with sed
How to parse csv format?