|
Posted by Jeff on December 29, 2008, 10:38 pm
Please log in for more thread options Álvaro G. Vicario wrote:
show/hide quoted text
> Jeff escribió:
>> How do I use a constant in a heredoc?
>> $sample = <<<sample_code
>> SOME_CONSTANT
>> sample_code;
>> echo $sample;
>> The constant in that case is just showing it's "name".
>
> As far as I know you cannot. Heredoc is not as useful as it looks :)
>
> Anyway, there's a user note that suggests a dirty trick:
>
> http://es2.php.net/manual/en/language.types.string.php#74744
Thanks, the "dirty" trick is a bit of an understatement!
Jeff
show/hide quoted text
>
>
>
|
>
>
> $sample = <<<sample_code
>
>
> SOME_CONSTANT
>
>
> sample_code;
>
> echo $sample;
>
>
>
> The constant in that case is just showing it's "name".