Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Francois-Victor LOUVEL
Francois-Victor LOUVEL
1,405 Points

Should the Included PHP file always contain a <?php ?> tag, on top of the one already present on the HTML side ?

I am a bit confused regarding this double <?php ?> tag issue. Will the included file ignore it's own blocks ?

What if i include a file that has many HTML and PHP block and is included within a single PHP block (i.e. <?php include myfile.php ?>) ? Will it simply include it and ignore the bad nesting of tags ?

1 Answer

Darrell Conklin
Darrell Conklin
21,988 Points

It will behave as though it closed the php block before including your php file. If you left a php block open in your included file it will automatically close that block and re-open the php block it was included inside of.

Also, the browser corrects the poorly nested html and places it inside the body of the html doc.