title: Add Quotes to CSV Export
body: <p>I'm exporting data to a CSV file using <code>fputcsv</code>. I have strings that are being written however I have a requirement that the data is wrapped in double quotes.</p>
  <pre><code>foreach ($orderDetails['lines'] as $line) {
       fputcsv($orderImportCsv, $line);
  }
  </code></pre>
  <p>This creates the following when opened in an editor (sublime)</p>
  <blockquote>
  <p>L,M3344,,100</p>
  <p>L,M3356,,50</p>
  </blockquote>
  <p>I need to have each of these fields wrapped in double quotes.</p>
  <p>So I have tried this:</p>
  <pre><code>foreach ($lines as &amp;$line) {
      foreach ($line as &amp;$column) {
          $column = '&quot;' . $column . '&quot;';
      }
  }
  </code></pre>
  <p>So essentially this should go through each lines fields and wrap it in &quot;&quot;. However after running that I get the following output:</p>
  <blockquote>
  <p>&quot;&quot;&quot;L&quot;&quot;&quot;,&quot;&quot;&quot;M3344&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;,&quot;&quot;&quot;100&quot;&quot;&quot;</p>
  <p>&quot;&quot;&quot;L&quot;&quot;&quot;,&quot;&quot;&quot;M3356&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;,&quot;&quot;&quot;50&quot;&quot;&quot;</p>
  </blockquote>
  <p>It's now putting 2 sets of double quotes around the variable!</p>
  <p>Is there a better way to do this?</p>
  <p><strong>UPDATE</strong></p>
  <p>I know <code>fputcsv</code> has two optional parameters. Delimiter and enclosure. However I believe enclosure defaults to &quot;&quot; but only when the string is split into separate words.</p>