Write array to txt file
<p>I have a form on a website that once completed holds the values in an array. I wish to put the contents of the array into a txt file, each submission on a new line, values seperated by '-':</p>

<pre><code>info-info-info-info
info-info-info-info
</code></pre>

<p>I've tried using:</p>

<pre><code>foreach ($clean as $info) {
    $file = fopen("userinfo.txt", "w");
    fwrite($file, $info);
    fclose($file);
}
</code></pre>

<p>This only put the last part of the array in the text file and overwrites the file on each submission.</p>

<p>Using:</p>

<pre><code>$results = var_export($clean, true); 
file_put_contents('userinfo.txt', $results);
</code></pre>

<p>writes all the info to the file correctly but stores as a var dump, and overwrites on each submission. I don't know how to format it to achieve what I need. Any help greatly appreciated.</p>
