title: How to print values of array on every line to text file in php?
body: <p>I have an array <code>$customers</code>, and want to print each value of the array to a text file. Array looks like this:</p>
  
  <pre><code>[0] = Sam, John, Rick
  [1] = Jacob, Richard, David
  [2] = Jesse, Frank, Louise
  </code></pre>
  
  <p>This is what I had in mind, but it doesn't seem to like <code>implode</code>:</p>
  
  <pre><code>$pos = 0;
      foreach ($customers as $customer)
      {
        $result = implode(" ",$customers[$pos]);
        //echo implode(" ",$customers[$pos]);
        file_put_contents('active.txt', $result);
        $pos = $pos + 1;
      }
  </code></pre>
  
  <p>The result I would expect in the text file is:</p>
  
  <pre><code>Sam, John, Rick
  Jacob, Richard, David
  Jesse, Frank, Louise
  </code></pre>
  
  <p>Can anyone explain how to do this? The goal is to have the array to appear comma delimited in a text file to export to Excel.</p>