Aureole Posted February 3, 2008 Share Posted February 3, 2008 Is it possible to have conditions within heredoc...e.g.: <?php $variable = 1; $var = <<<HDS <p>Some nice HTML and maybe a {$variable}</p> if( $variable == 1 ) echo( 'Conditional statement evaluated to true...' ); HDS; ?> Link to comment https://forums.phpfreaks.com/topic/89226-solved-conditions-within-heredoc-syntax/ Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 Is it possible to have conditions within heredoc No. Link to comment https://forums.phpfreaks.com/topic/89226-solved-conditions-within-heredoc-syntax/#findComment-456875 Share on other sites More sharing options...
Aureole Posted February 3, 2008 Author Share Posted February 3, 2008 Guess I could do the conditional statements first then assign the result to a variable, then use the variable inside the heredoc instead. Thanks. Link to comment https://forums.phpfreaks.com/topic/89226-solved-conditions-within-heredoc-syntax/#findComment-456878 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.