Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Please Help the Beginner? Embedded PHP in HTML. Re: Please Help the Beginner? Embedded PHP in HTML.

#107747
Senff
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 $somethingwould 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.