What strategies can be implemented to ensure consistent formatting of text with line breaks in PHP output across different systems or platforms?

When outputting text with line breaks in PHP, inconsistencies in formatting may arise across different systems or platforms due to variations in newline characters. To ensure consistent formatting, it is recommended to use the PHP_EOL constant, which represents the correct newline character for the current platform. By using PHP_EOL instead of hardcoded newline characters, the output will be formatted consistently regardless of the system or platform.

<?php
// Example of using PHP_EOL for consistent line breaks in PHP output
$text = "This is a sample text." . PHP_EOL;
$text .= "This text will have a line break on any platform." . PHP_EOL;
echo $text;
?>