How can you remove a line break when reading data from a text file in PHP?

When reading data from a text file in PHP, line breaks can be included at the end of each line. To remove these line breaks, you can use the `trim()` function in PHP. This function will remove any whitespace characters, including line breaks, from the beginning and end of a string.

$file = fopen("data.txt", "r");

while(!feof($file)) {
    $line = trim(fgets($file));
    // Process the line without line breaks
    echo $line . "<br>";
}

fclose($file);