I want to write the contents of an array to new file.
So far as it stands my file is only containing the last element of my array and not the first two. So the text in the file output2.txt is Edward only.
Have I misunderstood something here?
$array = array ("Sarah", "William", "Edward");
foreach ($array as $value) {
$myfile = fopen("output2.txt", "w") or die("Unable to open file!");
fwrite($myfile,$value);
fclose($myfile);
}