title: How to trim white spaces of array values in php
body: <p>I have an array as follows</p>
  
  <pre><code>$fruit = array('  apple ','banana   ', ' , ',     '            cranberry ');
  </code></pre>
  
  <p>I want an array which contains the values without the white spaces on either sides but it can contain empty values how to do this in php.the output array should be like this</p>
  
  <pre><code>$fruit = array('apple','banana', ',', 'cranberry');
  </code></pre>