What are potential pitfalls when manipulating strings in PHP, such as dealing with line breaks?
When manipulating strings in PHP, one potential pitfall is dealing with line breaks. Line breaks can vary depending on the operating system (e.g., \n for Unix/Linux, \r\n for Windows). To ensure consistent handling of line breaks, you can use the PHP_EOL constant, which represents the correct end-of-line character for the current platform.
// Example of handling line breaks using PHP_EOL constant
$string = "Hello" . PHP_EOL . "World";
echo $string;