PHP CSV file issues(part 2) <ul> <li><p>continue on <a href="http://stackoverflow.com/questions/27646693/php-duplicate-staffid?lq=1">PHP duplicate staffID</a></p></li> <li><p>code<br /> <code>$data[0] = 0001,Ali,N,OK</code><br /> <code>$data[1] = 0002,Abu,N,OK</code><br /> <code>$data[2] = 0003,Ahmad,N,OK</code><br /> <code>$data[3] = 0004,Siti,Y,Not OK. Only one manager allowed!</code><br /> <code>$data[4] = 0005,Raju,Y, Not OK. Only one manager allowed!</code> </p> <p>I write it as following:<br /></p> <pre><code>for($i = 0; $i &lt; 5; $i++) { $data[i] = $staffID[$i].','.$staffname[$i].','.$ismanager[$i].','.$remark[$i]; } </code></pre></li> <li><p>Next I go to write csv file.<br /></p> <pre><code>$file_format = "staffreport.csv"; $file = fopen($file_format,"w"); foreach($data as $line) { $replace = str_replace(",","|", $line); fputcsv($file, array($replace)); echo $replace.'&lt;br /&gt;'; } fclose($file); </code></pre></li> <li><p>output (echo $replace)<br /> 0001|Ali|N|OK<br /> 0002|Abu|N|OK<br /> 0003|Ahmad|N|OK<br /> 0004|Raju|Y|Only one manager allowed!<br /> 0005|Siti|Y|Only one manager allowed!<br /></p></li> <li><p>In CSV file (staffreport.csv)<br /> 0001|Ali|N|OK<br /> 0002|Abu|N|OK<br /> 0003|Ahmad|N|OK<br /> "0004|Siti|Y|Only one manager allowed!"<br /> "0005|Raju|Y|Only one manager allowed!"<br /></p></li> <li><p>Why my csv file have double quote("")? How do I solve it?</p></li> </ul>