use session variables in heredoc (<<<) PHP

PHP string can be speficied in four ways, 1) Single quoted, 2) Double quoted , 3) heredoc and 4) newdoc.
First two methods are very common and last two are used rarely.

While using heredoc, one can not simply use session variable in heredoc like normal variable,

$str_new = "This is testing normal variable!";

echo <<<EOF
hello world!

$str_new
EOF;

This code will give output as desired.
But, following code will give a parse error.

 session_start();
$_SESSION[''str''] = "This is testing session variable!";
echo <<<EOF
hello world!

$_SESSION['str']
EOF;

To, use session variable in heredoc, session variable has to be enclosed in curly brackets {} and it will give desired output.

session_start();
$_SESSION[''str''] = "This is testing session variable!";
echo <<<EOF
hello world!

{$_SESSION['str']}
EOF;

{$_SESSION['str']} is the proper way to show session variables in heredoc.