Home › Forums › Back End › Please Help the Beginner? Embedded PHP in HTML. › Re: Please Help the Beginner? Embedded PHP in HTML.
August 11, 2012 at 6:36 pm
#107747
Participant
In theory, you can “break” PHP and switch back to HTML as long as you don’t break it in the middle of a line. echo $something
would be a line that you can’t break, for example; you also can’t break in the middle of a line like this: if ($var==3) {
, but it’s fine to break the PHP after that whole line.
In general, I try to avoid breaking at all and use echo to write out HTML, but when the HTML would be a lot of lines, I do switch. So, like this for one line:
if ($var==3) {
echo 'The variable is 3';
}
?>
But this if there’s a lot of lines:
if ($var==3) {
?>
Results
Here are some of the results:
The variable is 3.
}
?>
Silly example maybe, but hope you know what I mean.