2

I have a php script which passes a value to a .txt file, there is no problem and it works, the only thing is I would like to append the value to the next line instead of just append the value right after another value so instead of "valuevalue" I would like:

value

value

My script:

$filename4 = "EmailsFromSignUp.txt";
$content = file_get_contents($filename4);
$content .= $emailFPay;
file_put_contents($filename4, $content);
DevLiv
  • 573
  • 7
  • 19

3 Answers3

5

Try

$content .= PHP_EOL . $emailFPay;
dbinns66
  • 790
  • 6
  • 7
1
$f = fopen("EmailsFromSignUp.txt", "a+");
fputs($f, "\n" . $emailFPay);
fclose($f);
Halayem Anis
  • 7,654
  • 2
  • 25
  • 45
0
$filename4 = "EmailsFromSignUp.txt";
$content = file_get_contents($filename4);
$content .= "\r\n" . $emailFPay;
file_put_contents($filename4, $content);
moffeltje
  • 4,521
  • 4
  • 33
  • 57