title: trim before implode in php to get trimmed strings
body: <pre><code>$array = array(' lastname ', ' email ', ' phone ');
  $comma_separated = implode(" ", $array);
  
  echo $comma_separated; // lastname  email  phone
  </code></pre>
  
  <p>I have the above code to combine or join string in PHP problem is if the element in array has extra in joined string it has extra space. </p>
  
  <blockquote>
    <p>Expected Result:Only one space between words in echo</p>
    
    <p>How to first trim each element in array before implode</p>
  </blockquote>