How can regular expressions be used in PHP to remove line breaks from a string?
To remove line breaks from a string in PHP using regular expressions, you can use the `preg_replace` function to replace all occurrences of line breaks with an empty string. This can be useful when you want to clean up user input or format text for display.
$string = "Hello\nWorld!";
$cleanedString = preg_replace("/\r|\n/", "", $string);
echo $cleanedString;