What are some efficient ways to store and concatenate multiple lines of content for email sending in PHP?

When sending emails in PHP, it is often necessary to concatenate multiple lines of content to create the body of the email. One efficient way to store and concatenate these lines is to use heredoc syntax, which allows for multi-line strings without the need for escaping characters. By storing each line of content in a variable and then concatenating them using the heredoc syntax, you can easily build the email body in a clean and readable way.

// Store multiple lines of content in variables
$line1 = "Hello,";
$line2 = "This is a test email.";
$line3 = "Thank you for reading.";

// Concatenate the lines using heredoc syntax
$emailBody = <<<EOT
$line1

$line2

$line3
EOT;

// Send the email with the concatenated body
mail('recipient@example.com', 'Test Email', $emailBody);