What is the best way to remove line breaks and create a single line string in PHP?

To remove line breaks and create a single line string in PHP, you can use the `str_replace()` function to replace line breaks with a space or any other desired character. This will effectively remove the line breaks and create a single line string.

// Input string with line breaks
$inputString = "This is a
multi-line
string.";

// Remove line breaks and create a single line string
$singleLineString = str_replace(array("\r", "\n", "\r\n"), ' ', $inputString);

echo $singleLineString;