Re: question about <<<EOF
| From: | Jochem Maas | Date: | Tue, 30 Sep 2008 06:31:45 +0000 |
| Subject: | Re: question about <<<EOF | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281149@lists.php.net to get a copy of this message | ||
LKSunny schreef:
> Hello,
>
> i want on inner EOF do something, calculate and call function ? can not ? if
> yes, how to ?
no you can't, store the results of calculation and function calls in
variables and use them in the HEREDOC statement.
a HEREDOC declaration is just a string declaration like these:
$s = 'foo';
$t = "bar";
they can't contain expressions, function calls or anything like that.
>
> <?
> echo <<<EOF
> some text....
> can i calculate on inner EOF ? 10*100 display 1000 ?
> can i add function on inner EOF ? date('Y') display 2008 ?
> any more text.
> EOF;
> //i want output is
> /*
> some text....
> can i calculate on inner EOF ? 1000 display 1000 ?
> can i add function on inner EOF ? 2008 display 2008 ?
> any more text.
> */
> ?>
>
> Thank You.
>
>
>