Check if a string has no characters or numbers at all
<p>In php, how can I check if a string has no characters at all.</p>

<p>Currently I do like below, and replace <code>-</code> with <code>' '</code>. But if a search string contained all bad words, it'll leave me with <code>'   '</code>(3 blank spaces). The length will still show as 3 and it'll head off to the sql processor. Any method to check if a string has no characters or numbers at all?</p>

<pre><code>$fetch = false;

#$strFromSearchBox = 'Why-you-foo-bar-I-ought-to-tar-you';
$strFromSearchBox = 'foo-bar-tar';

if(strlen($strFromSearchBox) &gt;=2)
{
    $newString = str_replace($theseWords,'',$strFromSearchBox);
    $newString = str_replace('-',' ',$newString);

    if(strlen($newString)&gt;=2)
    {   
        $fetch = true;
        echo $newString;
    }
}


if($fetch){echo 'True';}else{echo 'False';}
</code></pre>
