title: Saving more than one array in sequence in CSV file
body: <p>I am using this function to generate CSV file</p>
  
  <pre><code>function array_to_csv($input, $delimeter=',', $linebreak="\n", $enclosure='"') {
    if (!is_array($input))
      die("Please provide an array of data.");
  
   // $keys = array_keys($input);
    $values = array_values($input);
  
    foreach ($values as $k =&gt; $v) {
      // Not refactored
      $values[$k] = $enclosure.str_replace($enclosure, $enclosure.$enclosure, $v).$enclosure;
    }
  
    //print implode($delimeter, $keys);
    //print $linebreak;
    //print implode($delimeter, $values);
  
   $write = implode($delimeter, $values);
   $file='abc.csv';
  $fp = fopen($file, "w");
  fwrite($fp, $write);
    fclose($fp);
  
  }
  </code></pre>
  
  <p>In php I call this function as:</p>
  
  <pre><code>array_to_csv($title, $delimeter=',', $linebreak="\n", $enclosure='"');
  </code></pre>
  
  <p><code>$title</code> is my array I am passing to the function. Till this point, everything is okay, file is successfully saved. </p>
  
  <p>Now I want to writing CSV file using same function while calling more than 1 function such that:</p>
  
  <blockquote>
    <p>1: first element of array1 is written in file<br />
    2: first element of array2 is written in file<br />
    3: first element of array3 is written in file</p>
  </blockquote>
  
  <p>How can I accomplish this task? Have any one idea about it?</p>