Note that there are some explanatory texts on larger screens.

plurals
  1. POexplode and in_Array search not working
    text
    copied!<p>OK here is the code codepad here <a href="http://codepad.org/ZQz0Kn3R" rel="nofollow">http://codepad.org/ZQz0Kn3R</a> </p> <pre><code>function processContent($content, $min_count = 2, $exclude_list = array()) { $wordsTmp = explode(' ', str_replace(array('(', ')', '[', ']', '{', '}', "'", '"', ':', ',', '.', '?'), ' ', $content)); $words = array(); $wordsTmp2 = array(); $omit = array('and', 'or', 'but', 'yet', 'for', 'not', 'so', '&amp;', '&amp;amp;', '+', '=', '-', '*', '/', '^', '_', '\\', '|'); if(count($exclude_list)&gt;0){ $omit = array_merge($omit, $exclude_list); } foreach ($wordsTmp as $wordTmp) { if (!empty($wordTmp) &amp;&amp; !in_array($wordTmp, $omit) &amp;&amp; strlen($wordTmp) &gt;= $min_count) { $words[] = $wordTmp; } } return $words; } </code></pre> <p>OK this is my function which should return array of words by filtering from <code>$omit</code> variable. But when i use it the words in first <code>$omit</code> array are only filtered, The second merged from the <code>$exclude_list</code> is not filtered.</p> <p>I use my function this way :</p> <pre><code>$filter_array = explode("\n", words list separated by \n new line here); print_r(processContent('String gere for filtering', $min_word_length, $filter_array)); </code></pre> <p>The variable <code>$filter_array</code> is passed in to the exclude_list also is merged to omit variable but does not get filtered in return value. only first <code>$omit</code> value is filtered. Is there something wrong in code??</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload