0
가능한 중복 : 여기에 변수 $ filter_array도 통합되어 exclude_list에 전달됩니다 http://codepad.org/ZQz0Kn3R폭발와 in_array 검색이 작동하지
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 as $wordTmp) { if (!empty($wordTmp) && !in_array($wordTmp, $omit) && strlen($wordTmp) >= $min_count) { $words[] = $wordTmp; } } return $words; } $filter_array = explode("\n", words list separated by \n new line here); print_r(processContent('String gere for filtering', $min_word_length, $filter_array));
codepad 변수를 생략하지만 반환 값으로 필터링되지 않습니다. 첫 번째 $ 생략 값만 필터링됩니다. 코드에 문제가 있습니까?
예가 답을 얻을 수 없었다. 같은 질문을 게시 – Yalamber
반복 ... 당신이 빨리 답을 얻을 수 있도록에 추가 정보를 편집하지 않습니다 귀하의 원래 질문 –
이제 괜찮아 질 것입니다. – Yalamber