title: How to check if there are only spaces in string in PHP?
body: <pre><code>print_r(strlen(trim('     ')));
  </code></pre>
  
  <p>the result is 9</p>
  
  <p>I also tried </p>
  
  <pre><code>preg_replace('/[\n\r\t\s]/', '', '   ')
  </code></pre>
  
  <p>but the result is not zero.</p>
  
  <p><strong>Please download my code and you will get the result</strong></p>
  
  <p><a href="http://blog.eood.cn/attachment.php?id=70" rel="noreferrer">http://blog.eood.cn/attachment.php?id=70</a></p>