$bad = array("a","dog"); $string = $_POST['Username']; if (0 < count(array_intersect(array_map('strtolower', explode(' ', $string)), $bad))) { $errors[] = 'The user name must not contain any inapproprate language.'; }
strpos
Stack Overflow
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)