How can multiple lines of text be concatenated and stored in a variable in PHP?

To concatenate multiple lines of text in PHP and store them in a variable, you can use the concatenation operator (.) to join the lines together. You can also use the heredoc syntax for multi-line strings, which allows you to easily store multiple lines of text in a variable without the need for concatenation.

// Using concatenation operator
$text = "Line 1\n" .
        "Line 2\n" .
        "Line 3";

// Using heredoc syntax
$text = <<<EOD
Line 1
Line 2
Line 3
EOD;