As any whitespace in the HTML is ignored by the browser (treated as if it were a single space which then only makes a difference when it is between inline tags) the whitespace is not coming from the HTML/PHP you have posted (which is using block tags where whitespace is completely ignored). Check the CSS associated with the resulting HTML tags as something there is adding padding or margins that appear as whitespace on the page.
PHP doesn't cause whitespace as it is finished and done with before the page displays in the browser. It is possible for the whitespace to be in the HTML between inline elements but generally it comes from CSS.
To be able to determine if it comes from the HTML that the PHP is generating we'd need to see the HTML - not the PHP.
You can get whitespace if you indent <?php. You've probably already checked for that, but no harm in bringing it up.
Also, is this a problem outside of the Chrome dev-tool? Those double-quotes seem strange to me, since a whitespace should be more like " ". It strikes me more as a newline, but I have no idea why the Chrome dev-tool would quote nothing.
You are seeing double quotations there, not whitespace. Whitespace is ignored both by PHP and by HTML unless its in a preformatted block, or the CSS dictates it should be rendered.
Those are caused by the included files or the file output by the read. Check for the relevant lines in footer and menu.php files for the quotes. It can be caused by any output that you have, but if you can track it to where it lies relative to this (looks/sounds like the first lines of the code), check the files for the first lines of output to see what's in them.
Also, is this a problem outside of the Chrome dev-tool?
Quote:
Originally Posted by Fou-Lu
You are seeing double quotations there, not whitespace. Whitespace is ignored both by PHP and by HTML unless its in a preformatted block, or the CSS dictates it should be rendered.
Those are caused by the included files or the file output by the read. Check for the relevant lines in footer and menu.php files for the quotes. It can be caused by any output that you have, but if you can track it to where it lies relative to this (looks/sounds like the first lines of the code), check the files for the first lines of output to see what's in them.
It renders the same as <br /><br />. If the PHP echo has text inside it, (e.g., echo '<div id="hello">Paragraph:'; instead of echo '<div id="hello">';) "Paragraph:" is inside those quotes, instead of nothing. I have tried everything with menu.php and footer.php: they are not the problem.
__________________
Ask me anything about CSS! Learning PHP.
If the PHP echo has text inside it, (e.g., echo '<div id="hello">Paragraph:'; instead of echo '<div id="hello">';) "Paragraph:" is inside those quotes, instead of nothing.
Unless I'm misunderstanding you, that is not whitespace at all but rather how Chrome formats the string to make it easier to edit in dev tools. If you view the source of the page(CTRL-U) instead of viewing it in the dev tools you should see no extra whitespace inside of the tags. As others have stated, echo doesn't output any extra spaces with the default PHP configuration or any standard configuration that I've seen.