[nycphp-talk] Closing Tags or Not Closing Tags, that is my question...
David Krings
ramons at gmx.net
Tue Dec 18 13:53:37 EST 2007
Gary Mort wrote:
> When your including say...12 different files into a page, sometimes
> script number 8 needs to send header information. So the practice is to
> accumulate all the content information into a variable, and send that at
> the end of the script.
>
> This makes it no longer possible to mix HTML and PHP code in a
> document(ok, it's possible, but outside the scope of this email) as the
> second you have a raw HTML outside the PHP execution tags, you have lost
> your chance of sending header data and are into the sending of body data.
>
> The problem is when at the end of a file you place ?>[space]
>
> The PHP interpreter sees that there is a charector after the ?> and
> sends it. So now content has begun and you can no longer send headers.
Ah! Now I understand and see where the problem is. I am surprised that I
haven't run into this so far, but maybe I am just lucky or the IDEs I use take
of this.
Thanks! You should seek a carreer as instructor. :)
David
More information about the talk
mailing list