View Full Version : Coding in & out of <php ?>

10-18-2004, 10:18 AM
It seems to work, but do you think it's bad form to code in & out of php like this.....

if (1 == 1) {
?> // See we close off

1 IS equal to one!


} else {

// Hmmmmmm?



What I'm getting @ is still having the if statement open when we close the PHP tags & then start playing around with again after re-opening the PHP tags.

10-18-2004, 10:21 AM
It just becomes hard to manage in large scripts but theres nothing wrong with it.

10-18-2004, 10:39 AM
I suppose as long as you correctly indent all of your code, it is acceptable and you can manage it.

Personally, I find it good practice to echo everything within <?php ?> tags, especially when echoing variables within that string.

10-18-2004, 12:31 PM
Thanks for the responses! :)

10-18-2004, 06:26 PM
i usualy only close the php tag and continue on to html, if im working with a large section of html like a table with forms in it and such, or a large body of content.

10-18-2004, 07:22 PM
I've done it this way in the past, and still do to some extent, but in general if it's more than about 10 - 25 lines of HTML, I'll make an include file or function call to handle it.