php - explode and in_Array search not working -


possible duplicate:
explode , in_array search not working

codepad here http://codepad.org/zqz0kn3r

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', '&', '&', '+', '=', '-', '*', '/', '^', '_', '\\', '|'); if(count($exclude_list)>0){     $omit = array_merge($omit, $exclude_list); } foreach ($wordstmp $wordtmp) {    if (!empty($wordtmp) && !in_array($wordtmp, $omit) && strlen($wordtmp) >= $min_count) {              $words[] = $wordtmp;     } } return $words; } $filter_array = explode("\n", words list separated \n new line here); print_r(processcontent('string gere filtering', $min_word_length, $filter_array)); 

the variable $filter_array passed in exclude_list merged omit variable not filtered in return value. first $omit value filtered. there wrong in code??

you missing " in 16th line.

   $filter_array = explode("\n", "words list separated \n new line here");   

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -