A simple question, But I could not find a solution
$file = 'file.txt';
file_put_contents($file, "$time|$data<br>", FILE_APPEND);
file right now, after 2 times in loop:
03-24-2018|test03-24-2018|test
I need:
03-24-2018|test
03-24-2018|test
<?php
$file = 'file.txt';
file_put_contents($file, "$time|$data
", FILE_APPEND);
?>
You can use the predefined PHP_EOL
constant, new line characters are different depends on operating systems:
Windows:
Mac OS:
Unix-like systems:
$content = "$time|$data" . PHP_EOL;