Re: To ?> or not to ?>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On 12-04-03 05:29 PM, Tedd Sperling wrote:
Hi gang:

Let me start a religious war -- should one end their scripts with "?>" or not?

After years of never having a problem with ending any of my scripts with "?>", I found that several students in my class had scripts that did not produce the desired result even after they were given the scripts via highlight_file(") to cut and paste.

As it turned out, several students copy/pasted the script with an addition whitespace after the ending "?>" and as such the scripts did not run as expected. You see, the scripts created image but apparently the image delivery method objected to the additional whitespace.

Does anyone have more examples of where scripts will fail IF they end with "?>  " (note the additional space)?

It's standard practice to NOT include the closing ?> on anything remotely resembling a class or lib source file. As has been mentioned on this list and originally on PHP internals on several occasions, the optionality of the closing tag is intentional :)

E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

PHP General Mailing List (
To unsubscribe, visit:

[PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [Find Someone]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux