How does the str_replace function in PHP handle different types of line breaks?

The str_replace function in PHP can handle different types of line breaks by using the PHP_EOL constant to represent the end of a line. This constant is platform-independent and will automatically be replaced with the appropriate line break character based on the operating system.

$text = "Hello World" . PHP_EOL . "This is a new line.";
$new_text = str_replace(PHP_EOL, "<br>", $text);
echo $new_text;