php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64183 Why no str_PUTcsv()?
Submitted: 2013-02-10 12:37 UTC Modified: 2021-09-19 04:22 UTC
Votes:29
Avg. Score:4.2 ± 0.8
Reproduced:25 of 25 (100.0%)
Same Version:10 (40.0%)
Same OS:15 (60.0%)
From: cstdenis at ctgameinfo dot com Assigned: cmb (profile)
Status: No Feedback Package: Strings related
PHP Version: 5.4.11 OS: n/a
Private report: No CVE-ID: None
 [2013-02-10 12:37 UTC] cstdenis at ctgameinfo dot com
Description:
------------
There is a fgetcsv(), fputcsv(), str_getcsv(), but str_putcsv() is missing. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-13 22:17 UTC] sunseb at live dot com
Yes, the PHP language need this feature ! :-)
 [2017-09-27 14:11 UTC] cmb@php.net
function str_putcsv(
    array $fields,
    string $delimiter = ',', 
    string $enclosure = '"', 
    string $escape_char = '\\'
) {
    $stream = fopen('php://memory', 'w+');
    fputcsv($stream, $fields, $delimiter, $enclosure, $escape_char);
    rewind($stream);
    return stream_get_contents($stream);
}
 [2021-09-09 11:03 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-09-09 11:03 UTC] cmb@php.net
> Yes, the PHP language need this feature ! :-)

Why?  Just for the sake of providing a (possibly reasonable)
counterpart to an unreasonable str_getcsv() isn't a proper
argument.  Can anyone provide a use case where str_fputscsv()
would be helpful?
 [2021-09-19 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 18:01:30 2024 UTC