Filter a set of bad words out of a PHP array

前端 未结 5 748
你的背包
你的背包 2021-01-16 03:42

I have a PHP array of about 20,000 names, I need to filter through it and remove any name that has the word job, freelance, or project

5条回答
  •  渐次进展
    2021-01-16 04:46

    This should be what you want:

    if (!preg_match('/(freelance|job|project)/i', $name)) {
        $cleanArray[] = $name;
    }
    

提交回复
热议问题