title: Store PHP Variable in CSV file
body: <p>I want to store my PHP variable in a CSV file.</p>
  <p>As they are individual variables and I need to store them in row columns format.</p>
  <p>for ex- ID, First Name, Last Name, Address, Phone. etc.</p>
  <p>suppose I have variable $id, $firstname, $lastname, $address, $phone.</p>
  <p>How can I store this variable in a single row separated by a column in a CSV file?</p>
  <p>I tried using an array but as they are individual variables and use in entire my program so I want to add this variable at end of the script to CSV to maintain the report.</p>
  <pre><code>$fp = fopen($filename, &quot;w&quot;);
  
  $fp = fopen(&quot;ouput.csv&quot;, w)
  
  fputcsv($fp,array(array($id,$firstname, $lastname,$address,$phone)));
  
  fclose($fp);
  </code></pre>
  <p>Thanks in advance.</p>