What best practice should be followed when writing to a file in PHP to ensure each entry is on a new line?

When writing to a file in PHP, it is important to ensure that each entry is on a new line to maintain readability and organization. To achieve this, you can use the "\n" character at the end of each entry to signify a new line.

// Open the file in append mode
$file = fopen("data.txt", "a");

// Write a new entry to the file followed by a new line character
fwrite($file, "New entry\n");

// Close the file
fclose($file);