explode and in_Array search not working

前端 未结 2 1852
抹茶落季
抹茶落季 2021-01-17 03:39

OK here is the code codepad here http://codepad.org/ZQz0Kn3R

function processContent($content, $min_count = 2, $exclude_list = array()) {
    $wordsTmp = ex         


        
相关标签:
2条回答
  • 2021-01-17 04:13

    The problem is because $filter_array has spaces in it. Either:

    $filter_array = array_map(function($el) { return trim($el); }, $filter_array);
    

    Or

    foreach ($filter_array as &$element) {
        $element = trim($element);
    }
    
    0 讨论(0)
  • 2021-01-17 04:15

    http://codepad.viper-7.com/BrZ9Rm

    you will need to pass it through trim:

    $filter_array = array_map(function($el) { return trim($el); }, $filter_array);
    
    0 讨论(0)
提交回复
热议问题