What is the correct syntax for adding a newline character ("\n") to a string in PHP?
To add a newline character ("\n") to a string in PHP, you can simply concatenate the "\n" to the end of the string. This will create a line break in the output when the string is displayed. Alternatively, you can use the PHP_EOL constant which represents the correct newline character for the current platform. This ensures that the correct newline character is used regardless of the operating system.
// Using "\n" to add a newline character to a string
$string = "Hello, World!\n";
// Using PHP_EOL constant to add a newline character to a string
$string = "Hello, World!" . PHP_EOL;