test.php
<?php
$filec = fopen('test.txt','w');
$arr = file('test.txt');
foreach ($arr as $key => $value) {
fwrite($filec,$value);
}
fclose($filec);
?>
test.txt
asdjlaksjd
asdhfwejkyhtjkre
jfdhgdjkf'hgjldsff
sfjnkbnm,cv
sm,nxcm,b,
sdjlhfskld
jfsdfwerwlur
slfdjsdkljfklsdjf
When I run test.php, test.txt is emptied. Does anyone know why?
Echoing $value, etc seems to work.