What are some best practices for handling newline characters in PHP string functions?

When working with strings in PHP, it's important to handle newline characters properly to ensure consistent behavior across different operating systems. One common approach is to use the PHP_EOL constant, which represents the newline character specific to the current platform. By using PHP_EOL in string functions, you can ensure that your code correctly handles newline characters regardless of the underlying system.

// Example of using PHP_EOL to handle newline characters
$string = "Hello" . PHP_EOL . "World";
echo $string;