php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #27549 Removing whitespace after closing tag should be optional
Submitted: 2004-03-10 09:19 UTC Modified: 2004-03-10 11:57 UTC
From: zizka at seznam dot cz Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.4 OS: All
Private report: No CVE-ID: None
 [2004-03-10 09:19 UTC] zizka at seznam dot cz
Description:
------------
Removing whitespace after closing tag is quite annoying and should be optional.

Every webmaster looks into the page code to see what's the problem, and when he drops out of PHP parsing mode with ?> instead of echo()ing, the resulting code is quite awful:

<table>
<? while(list(,$val)=each($a)){?>
  <tr><td><?=$val['caption']?></td>
    <td><?=$val['text']?></td>
  </tr><?}?>
</table>

Without this feature, the output would be like this:

<table>

  <tr><td>About PHP</td>
    <td>PHP's quite good thing, but still can be better</td>
  </tr>
  <tr><td>About PHP</td>
    <td>PHP's quite good thing, but still can be better</td>
  </tr>
</table>

But, because of it, instead of such nice code we get:

<table>
  <tr><td>About PHP</td>
    <td>PHP's quite good thing, but still can be better</td>
  </tr>  <tr><td>About PHP</td>
    <td>PHP's quite good thing, but still can be better</td>
  </tr></table>

I could come up with better examples, but they would be too complex. But believe me, sometimes I get a line > 2000 characters long!
(And adding echo "\n"; is out of question.)  Thx



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-10 09:26 UTC] derick@php.net
Already filed, and already declined.
 [2004-03-10 11:57 UTC] zizka at seznam dot cz
It wouldn't break ANY script if it was optional in the php.ini file.

Are the Zend developers getting too lazy to improve their engine a bit?

This feature, actually an intended bug, makes a lot of people mad. Tell me why shouln't it have a directive in php.ini like  closing_tag_trimmed = On | Off , On by default ???
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 11 08:00:01 2025 UTC