Re: How to Escape Ternary Within Here Document?
Michael Ruebner schreef:
> Hi,
>
> How do I escape a ternary statement within a 'here document' construct?
>
> Example:
>
> echo <<<EOS
> Some stuff here.
> Some more stuff.
> (check($this))?'Even more stuff!':'Enough!'
> EOS;
>
> TIA
>
> Mike
Hi Mike,
The answer is simple: You dont.
Only simple variable substituation is done inside a heredoc.
So the easiest solution for you probably is: do the ternary statement
before the heredoc, and use its results (in a plain var) inside the heredoc.
Or start using some templatesystem if that suits your needs.
Good luck.
Regards,
Erwin Moller
|