Consider:
The value of my_const is {my_const}.
MYECHO;
?>
Here is an little trick to allow double-quoted strings and heredocs to contain arbitrary expressions in curly braces syntax, including constants and other function calls. It uses the fact that a function name can be assigned to a variable and then called within heredoc:
= 5.3
// Use a closure (anomynous function) like so:
$_ = function ($val){return $val;};
// Our test values
define('abc', 'def');
define('ghi', 3);
$a = 1;
$b = 2;
function add($a, $b) { return $a+$b; }
// Usage
echo "b4 {$_(1+2)} after\n"; // Outputs 'b4 3 after'
echo "b4 {$_(abc)} after\n"; // Outputs 'b4 def after'
echo "b4 {$_(add($a, $b)+ghi*2)} after\n"; // Outputs 'b4 9 after'
$text = <<