Home  >  Article  >  Backend Development  >  a filter function

a filter function

WBOY
WBOYOriginal
2016-08-08 09:23:00907browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn