How can PHP developers allow for line breaks in user input fields without affecting tooltip functionality?

When allowing line breaks in user input fields, PHP developers can use the nl2br() function to convert newline characters to <br> tags. This will display the line breaks in the user input without affecting the functionality of tooltips.

$user_input = $_POST[&#039;user_input&#039;];
$user_input_with_line_breaks = nl2br($user_input);
echo $user_input_with_line_breaks;