Are there any PHP functions or methods that can be used to automatically format text outputs for better readability?

When displaying text outputs in PHP, it can sometimes be challenging to ensure that the text is formatted in a readable way for users. One way to automatically format text outputs for better readability is by using the PHP `nl2br()` function. This function converts newline characters in a string to HTML line breaks, making the text easier to read when displayed on a webpage.

$text = "This is some text with\na newline character.";
echo nl2br($text);
```

This code snippet will output:
```
This is some text with
a newline character.