How can I format a long string in PHP without it becoming too cluttered with concatenation?

When dealing with long strings in PHP, it can become cluttered and hard to read when using concatenation to format the string. One way to solve this issue is by using the heredoc syntax, which allows you to define a block of text without having to worry about escaping quotes or using concatenation.

// Example of using heredoc syntax to format a long string
$longString = <<<EOT
This is a long string that spans multiple lines
and can contain variables like $variable1 or $variable2
without the need for concatenation.
EOT;

echo $longString;