note 115902 deleted from language.constants by cmb
| From: | cmb@php.net | Date: | Tue, 05 Jul 2016 12:55:36 +0000 |
| Subject: | note 115902 deleted from language.constants by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205884@lists.php.net to get a copy of this message | ||
Note Submitter: alterg79 at gmail dot com
----
There is a way to access a constant in heredoc.
Here is the example:
<?php
define("__STR",'constant.string.defined');
function heredocGetConstant($constant) {
return constant($constant);
}
$heredocGetConstant = 'heredocGetConstant';
$my_string = <<<EOT
This is my constant printed from heredoc: {$heredocGetConstant('__STR')}
EOT;
echo $my_string;
Output:
This is my constant printed from heredoc: constant.string.defined