From fcbbbd9fda2c03ed4a2e02ac23f2c06f8983f9d0 Mon Sep 17 00:00:00 2001 From: Sergey Panteleev Date: Tue, 28 Sep 2021 14:18:31 +0300 Subject: [PATCH] [PHP 8.1] Update `fputcsv` and `SplFileObject::fputcsv` description (#978) --- reference/filesystem/functions/fputcsv.xml | 32 ++++++++++++++++------ reference/spl/splfileobject/fputcsv.xml | 16 +++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/reference/filesystem/functions/fputcsv.xml b/reference/filesystem/functions/fputcsv.xml index f6298697cf..8c1890d5c8 100644 --- a/reference/filesystem/functions/fputcsv.xml +++ b/reference/filesystem/functions/fputcsv.xml @@ -10,16 +10,17 @@ &reftitle.description; intfalsefputcsv - resourcehandle + resourcestream arrayfields stringseparator"," stringenclosure'"' - stringescape_char"\\" + stringescape"\\" + stringeol"\n" fputcsv formats a line (passed as a fields array) as CSV and writes it (terminated by a - newline) to the specified file handle. + newline) to the specified file stream. @@ -28,7 +29,7 @@ - handle + stream &fs.validfp.all; @@ -60,22 +61,31 @@ - escape_char + escape - The optional escape_char parameter sets the + The optional escape parameter sets the escape character (at most one single-byte character). An empty string ("") disables the proprietary escape mechanism. + + eol + + + The optional eol parameter sets + a custom End of Line sequence. + + + If an enclosure character is contained in a field, it will be escaped by doubling it, unless it is immediately preceded by an - escape_char. + escape. @@ -99,10 +109,16 @@ + + 8.1.0 + + The optional eol parameter has been added. + + 7.4.0 - The escape_char parameter now also accepts an empty + The escape parameter now also accepts an empty string to disable the proprietary escape mechanism. diff --git a/reference/spl/splfileobject/fputcsv.xml b/reference/spl/splfileobject/fputcsv.xml index f78d47d42e..488990a890 100644 --- a/reference/spl/splfileobject/fputcsv.xml +++ b/reference/spl/splfileobject/fputcsv.xml @@ -14,6 +14,7 @@ stringseparator"," stringenclosure"\"" stringescape"\\" + stringeol"\n" Writes the fields array to the file as a CSV line. @@ -59,6 +60,15 @@ + + eol + + + The optional eol parameter sets + a custom End of Line sequence. + + + @@ -102,6 +112,12 @@ + + 8.1.0 + + The optional eol parameter has been added. + + 7.4.0