KevinM1 Posted December 5, 2006 Share Posted December 5, 2006 Is it possible to use a function call within a heredoc if I use curly braces? In other words, would something like the following correctly use nl2br and put the result in the output?[code]<?phpecho <<<EOF<div> <!-- left side --><img src="$row['pic_url']" alt="" /><br /><p>{nl2br($row['description']);}</p></div><div> <!-- right side --><p>$row['name']</p><p>$row['price']</p></div>EOF;?>[/code] Link to comment https://forums.phpfreaks.com/topic/29559-heredoc-question/ Share on other sites More sharing options...
.josh Posted December 5, 2006 Share Posted December 5, 2006 you can't do that. what you would do is make a temporary variable that calls the function like $blah = nl2br($row['description']); and then use that variable inside the heredoc. Link to comment https://forums.phpfreaks.com/topic/29559-heredoc-question/#findComment-135606 Share on other sites More sharing options...
KevinM1 Posted December 5, 2006 Author Share Posted December 5, 2006 [quote author=Crayon Violent link=topic=117462.msg479209#msg479209 date=1165344136]you can't do that. what you would do is make a temporary variable that calls the function like $blah = nl2br($row['description']); and then use that variable inside the heredoc. [/quote]Thanks for the fast reply! :) Any chance you'd mind taking a stab at my autoload question I have a few posts down? ;) Link to comment https://forums.phpfreaks.com/topic/29559-heredoc-question/#findComment-135611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.