Php – way to force a new line after php closing tag ?> when embedded among html

code formattingconfigurationPHP

I have been searching online with little success for a way to force php to output a newline after a closing php tag ?> so that my HTML will be rendered as I see it before its parsed by PHP so that it will look neat and tidy when viewing the html source code for a page.

I want to stop it from removing the newline and causing the next line from wrapping up and therefore ruining the format of the page. Is there a specific php.ini setting I can change to disable this behaviour?

All my code logic files have ?> removed from the end of them so I wont need to worry about them injecting extra newlines which is why I believe PHP was coded to strip the trailing new lines.

Best Answer

Richard is saying this:

Hello <? ?>
Jello

...after PHP-parsing becomes this:

 Hello Jello


I just add an extra newline manually, like this:

Hello <? ?>

Jello

...giving this:

Hello
Jello
Related Topic