Skip to content
Advertisement

how to concatenate my strings with php in html

I know how to concatenate php variable but how about php if else script inside html? I have used below code:

JavaScript

How do I concatenate my strings especially when the php if else statement? Thanks for help

Advertisement

Answer

You can’t do that. The cleanest solution would be to put the if statement before the generation of $output i.e.

JavaScript

For such large blocks of text, you might want to consider heredoc syntax. See this demo.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement