PHP - make sure string has no whitespace
<p>How can I check if a PHP string contains any white space?  I want to check if white space is in there, and then echo back an error message if true</p>

<pre><code>if(strlen($username) == whitespace ){

                echo "&lt;center&gt;Your username must not contain any whitespace&lt;/center&gt;";
</code></pre>
