Whitespace

Whitespace refers to spaces, tabs, and newline characters: those characters are invisible on a white background, hence the name.

Whitespace is used to format and organize the code, making it more readable.

However, in PHP, whitespace is generally not significant in terms of parsing; the PHP interpreter usually ignores whitespace. There are some rare situations where the whitespaces have a role : in heredoc syntax, and for formatting floats.

Whitespace is not a notion specific to PHP : other languages have them too. For example, trim() removes whitespace at the beginning and the end of a string value.

<?php

$heredoc = <<<HEREDOC
     One tab shift
     Here
     HEREDOC;

$x = 1 . 0; // This is 10

$y = 1.0; // This is 1.0

$z = 1. 0; // This is a syntax error

?>

See also php_strip_whitespace(), Be careful of whitespace in .php files