roles as $role){ if(in_array($role, $allowed) && !in_array($role, $notallowed)) { $valid=TRUE; } } return $valid; ?>