How can you ensure that a line break is inserted when writing data to a file in PHP?
When writing data to a file in PHP, you can ensure that a line break is inserted by appending the "\n" character at the end of each line of data being written. This will create a new line in the file for each piece of data.
$data = "First line of data\n";
$file = fopen("example.txt", "a");
fwrite($file, $data);
fclose($file);