<?php $forbidden_words = array("word1", "word2", "word3"); $string = "a very long text .... word"; if(preg_match('/\b(' . implode('|', array_map('preg_quote', $forbidden_words)) . ')\b/', $string)) { echo 'have forbidden word(s)'; } else { echo 'no forbidden words'; }
You have javascript disabled. You will not be able to edit any code.