What potential pitfalls should be considered when using Heredoc notation in PHP for defining strings with variables and constants?

When using Heredoc notation in PHP to define strings with variables and constants, it's important to be cautious of potential parsing issues that may arise if the variables or constants are not properly enclosed in curly braces. To avoid any unexpected behavior, always ensure that variables and constants are enclosed within curly braces to explicitly indicate where the substitution should occur.

$name = "Alice";
$age = 30;
define('COUNTRY', 'USA');

// Correct way to use Heredoc with variables and constants
$text = <<<EOT
Hello, my name is {$name}. I am {$age} years old and I live in {COUNTRY}.
EOT;

echo $text;