Use PHP_EOL
which produces \r\n
or \n
$data="my data" . PHP_EOL . 'my data';
$fp = fopen('my_file', 'a');
fwrite($fp, $data);
fclose($fp);
// File output
my data
my data
Use PHP_EOL
which produces \r\n
or \n
$data="my data" . PHP_EOL . 'my data';
$fp = fopen('my_file', 'a');
fwrite($fp, $data);
fclose($fp);
// File output
my data
my data