title: Array of words remove by length?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4910301/php-filter-array">PHP: Filter array</a>  </p>
  </blockquote>
  
  
  
  <p>I have a PHP array containing strings of random length.  </p>
  
  <p>I want need to keep those that are less than 6 characters long.</p>
  
  <p>How can I do this?</p>
  
  <p>Solution:  I used this which is like Fardjad's answer:</p>
  
  <pre><code>$counter=0;
  foreach ($myarray as $value) {
      if (strlen($value) &gt;=$maxlength) {
  unset($myarray[$counter]);
     }
   $counter++;
  }
  </code></pre>