WordPress.org

Support

Support » Miscellaneous » Will whitespace (tabs, spaces, etc) make bricks?

Will whitespace (tabs, spaces, etc) make bricks?

  • I just read in another post that a tab at the beginning of a file messed up the system.

    Say what?

    Html ignores any whitespace greater than one space (unless it is coded as a space:  ). I assumed the same with php. Is that incorrect?

    Will whitespace (i.e. spaces and tabs) mess up php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • If it is before the first
    <?php...
    YES, it will.

    Wow, that’s bananas.
    Thanks.

    Will whitespace (i.e. spaces and tabs) mess up php?

    Not directly, no. But it can.

    PHP gives you the ability to modify the actual HTTP headers directly. WordPress uses this ability. However, if there is actual output, including whitespace, before the attempt to modify the headers, then you get an error. This is because the headers must come first in the resulting output.

    HTML does not give you the ability to modify headers. PHP is generating HTML code as output, but it has those headers to deal with too. So yes, in certain cases, badly placed whitespace can break your page.

    Now, it won’t do it in (most of) the Template files, which is the only thing an inexperienced user should ever be editing. But it can do it in plugins or the functions.php template file.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Will whitespace (tabs, spaces, etc) make bricks?’ is closed to new replies.
Skip to toolbar