This one is bothering me for a while. Let's say we have a simple PHP-File:
Line 0
Line 1
<?="Line 2"?>
Line 3
Processing this file will result in:
Line 0
Line 1
Line 2Line 3
Where did the line feed after ?>
go? The linefeed is not beeing devoured when placing some character after the closing tag (e.g. ?>.
).
Is there a way to control this behaviour? I'm not willing to place whitespaces after the closing tag, because my IDE is configured to remove whitespaces before linefeeds (and I like it that way).
Yes, indeed:
The closing tag for the block will include the immediately trailing newline if one is present.
http://php.net/manual/en/language.basic-syntax.instruction-separation.php
Meaning, if the ?>
is the last thing on the line, the newline will be removed as part of the closing PHP block. You need to explicitly echo
a newline or add an additional newline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With