title: how to remove first and last spaces in php
body: <pre><code> $search = substr($search_string, 0, -1);
  </code></pre>
  
  <p>It is only removing last one space only. Some times in last character after having 2 or more spaces how to remove all spaces after word last character and if some times end user entered first character space how to remove also first character?</p>