Hello:
I am using heredoc syntax to build a confirmation message after a user submits a form. For one element, the description (represented by $desc), I want to use nl2br. How do I make this work? Here is what I tried, and it didn't work:
$conf_msg = <<<cnfmsg
<h1> $title </h1>
<p><strong> Submitted By: $user </strong> </p>
<p> {nl2br($desc)} </p>
cnfmsg;
It just printed the character literally.
Edit:
I made it work by applying nl2br to the variable outside the heredoc string. But I am still curious as to why the curly brackets didn't allow me to call the function inside the string?
Thanks