1--TEST-- 2SplFileObject::fputcsv() with user provided eol 3--FILE-- 4<?php 5$data = [ 6 ['aaa', 'bbb', 'ccc', 'dddd'], 7 ['123', '456', '789'], 8 ['"aaa"', '"bbb"'], 9]; 10 11$eol_chars = ['||', '|', '\n', "\n"]; 12foreach ($eol_chars as $eol_char) { 13 $file = new SplTempFileObject; 14 foreach ($data as $record) { 15 $file->fputcsv($record, ',', '"', '', $eol_char); 16 } 17 18 $file->rewind(); 19 foreach ($file as $line) { 20 echo $line; 21 } 22 23 echo "\n"; 24} 25?> 26--EXPECT-- 27aaa,bbb,ccc,dddd||123,456,789||"""aaa""","""bbb"""|| 28aaa,bbb,ccc,dddd|123,456,789|"""aaa""","""bbb"""| 29aaa,bbb,ccc,dddd\n123,456,789\n"""aaa""","""bbb"""\n 30aaa,bbb,ccc,dddd 31123,456,789 32"""aaa""","""bbb""" 33