note 91306 deleted from function.str-getcsv by cmb
| From: | cmb@php.net | Date: | Sun, 09 Feb 2020 08:21:18 +0000 |
| Subject: | note 91306 deleted from function.str-getcsv by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214054@lists.php.net to get a copy of this message | ||
Note Submitter: dave_walter at yahoo dot com
----
Just to clarify, my str_putcsv() function was only ever designed to complement the functionality of
the str_getcsv() built-in function, which can only handle converting one line of input into a single
level array. For example, this code:
<?php
var_dump( str_getcsv( "a,b,c\nd,e,f", "," ));
?>
generates this output:
array(5) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(3) "c
d"
[3]=>
string(1) "e"
[4]=>
string(1) "f"
}
Even fgetcsv() and fputcsv() only work with a single line. All the examples show them being used
within a loop of some sort.
I was also avoiding the artificial restriction on the length of the CSV string introduced by
Ulf's modification.