You are here: Re: Calling function in heredoc block « PHP Language « IT news, forums, messages
Re: Calling function in heredoc block

Posted by ZeldorBlat on 03/28/07 01:42

On Mar 27, 4:26 pm, "Laiverd.COM" <share_your_knowle...@someserver.nl>
wrote:
> Simple question on which I could not find an answer. How would I - if
> possible at all - call a function within a heredoc block of text? Example
>
> function showSomething(){
> echo <<<END
> A long block of text with a function() in the middle.
> END
>
> }
>
> Thanks for any input.
>
> John

As far as I know you can't. The parser is looking for tokens
beginning with $ (i.e. variables) inside the heredoc block. Your best
bet is to just assign the result of your function to a variable before
the heredoc block, then include the variable in the text.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация