How to clean a record before rendering it?

When I use strip_tags;

$str = "<p>hello.</p>\n<p>count(): Parameter must be an array or an object that implements Countable<br><br><br></p>\n";

echo strip_tags($str);

//hello.\ncount(): Parameter must be an array or an object that implements Countable\n 

The tags are removed which is expected, but I also want to convert the some of the escape sequences to a new line. Is there a way to do that?

nl2br?