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; ?> Quote 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. Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.