Non Breakable Spaces¶
Space is one of the base ASCII characters. They are often used to separate words, and are forbidden from being used in names.
PHP supports Unicode characters, and some of the characters are called: non breaking spaces. They behave like a space, by displaying a blank area. Yet, they are recognized internally as a non-space, and can be used in a name.
Non-breakable spaces are useful for tests, as they make the testing name more readable. They are also quite rare, and confusing for newcomers.
Unbreakable spaces is \u{00A0} as a PHP escape sequence, or \xc2\xa0 as ASCII characters; it is the HTML escape sequence .
<?php
// This is a space, PHP doesn't compile this code
const A B = 1;
// This is a non breakabe space, it compile and is not visibly different from the line above
const A B = 1;
echo A B;
?>
See also Non breakable space in PHP, Handling Invisible characters with PHP, Non-Breaking Spaces and UTF-8 Madness and Using non-breakable spaces in test method names.