note 118439 deleted from function.substr by peehaa
| From: | peehaa@php.net | Date: | Mon, 28 Nov 2016 19:57:45 +0000 |
| Subject: | note 118439 deleted from function.substr by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207726@lists.php.net to get a copy of this message | ||
Note Submitter: b at asdflolinternet dot de
----
/** what:IF A SUBSTR FROM THE GIVEN ARRAY VALUES IS IN FULL STR
* This Function makes it possible to ask php like the way if
* there is this or that word/letter and/or signs within any
* full Context such as HTML a Text or something for example
* @:return true if one of the arr value(s) found in $string
* note: altenatively $array can also be a textstring if you
* just look out for one occurance of a word in a full text
*/ function substrisInString($string,$array)
{ $count=0;
if(is_array($array))
{ foreach($array as $val)
{ if(substr_count($string,$val)>0)
{$count++;}
}
}
else //str instead of arrayvals sent
{ if(substr_count($string,$array)>0)
{$count++;}
}
return($count>0)?true:false;
}