Your code has a non-breaking space character (\u00A0
) after the ||
.
Additionally PHP is stupid enough to consider that byte a viable identifier, thus it thinks
<nbsp>(!filter_var($email, FILTER_VALIDATE_EMAIL))
is a function call, not unlike
myfunction(!filter_var($email, FILTER_VALIDATE_EMAIL))
whereas
<nbsp>!filter_var($email, FILTER_VALIDATE_EMAIL)
is a syntax error (as would be myfunction!filter_var($email, FILTER_VALIDATE_EMAIL)
), as !
cannot be used as a binary operator).
Typing such non-breaking spaces happens fairly commonly in keyboard layouts wherein you must type the pipe character |
with Alt Gr, such as the standard Finnish layout that I am using. This occurs because you still have the Alt Gr pressed down while hitting the space bar; on many layouts Alt Gr + will produce a non-breaking space. (Note that I myself used non-breaking space in my answer to make the space-bar key ;)
A good editor would be able to mark such an use a syntax error, or perhaps you can configure your editor to highlight such mistakes.