(PHP 5.3.6)
I have a php file which contains simply this text - there are no php tags, no trailing newline or extraneous whitespace anywhere:
<div style="border:1px solid green">abc</div>
Now including this from another php file as follows (again, with no extraneous whitespace anywhere):
<div style="border:1px solid red"><?php include "abc.php" ?></div>
<br />
<div style="border:1px solid red"><div style="border:1px solid green">abc</div></div>
I get the result below.
Note that the second method just uses the included content directly. These should both be like the lower one, but as you can see the include causes some wierd kind of newline to be inserted before the content of the included file. I say 'wierd' because when I check the outputted source (via Chrome's view source) there is nothing visible there:
When this section of the page is shown in Chrome's element inspector, there seems to be something there but what exactly it is I can't tell:
It appears to be simply an empty string, but why an empty string would cause newlines and why it would be there in the first place are a mystery. Adding a semicolon to the end of the include statement makes no difference. It occurred to me that it might be a null byte or a 13 (CR) but that should still not cause an HTML line break.
Does anyone know how I can get rid of this unwanted newline?