NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP-related book comments

Chris Shiflett shiflett at php.net
Wed Jul 14 19:13:06 EDT 2004


--- Brian Pang <bpang at bpang.com> wrote:
> If there was any "magic" feature to be added, it should be an auto
> trim() to include[_once]|require[_once] files
> 
> so frustrating to get that message because of a trailing \n|\r after the
> closing ?>

Actually, you have to have two newlines after a closing PHP tag to matter,
and this annoys me (I think it annoys Hans, too, since I seem to recall a
bug report with his name on it).

Here's why it annoys me. Run this code:

<table>
   <tr>
      <td>
         <? echo 'Foo'; ?>
      </td>
   </tr>
</table>

You'll get this:

<table>
   <tr>
      <td>
         Foo      </td>
   </tr>
</table>

Yuck. :-)

The reasoning behind this, as I understand it, is simply to help avoid
problems caused by undesired output at the end of included files. It seems
that there is surely a way to avoid the problem without resorting to this
"solution," but I may be missing something important.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming Fall 2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/



More information about the talk mailing list