Home >Backend Development >PHP Tutorial >a filter function
Define an array
contains all illegal strings
Write a function
return false when the input string contains illegal strings
function checkForbidPoi($from_name, $to_name, $forbidPoi){
$isSend = true;
foreach ($forbidPoi as $word) {
if (strpos($from_name, $word) === false && strpos($to_name, $word) === false) {
} else {
$ isSend = false;
break;
The above introduces a filter function, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.