note 118439 added to function.substr
| From: | b at asdflolinternet dot de | Date: | Sun, 06 Dec 2015 14:04:30 +0000 |
| Subject: | note 118439 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204292@lists.php.net to get a copy of this message | ||
/** 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;
}
----
Server IP: 72.52.91.14
Probable Submitter: 80.129.144.36
----
Manual Page -- http://php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/118439
Del: integrated -- https://master.php.net/note/delete/118439/integrated
Del: useless -- https://master.php.net/note/delete/118439/useless
Del: bad code -- https://master.php.net/note/delete/118439/bad+code
Del: spam -- https://master.php.net/note/delete/118439/spam
Del: non-english -- https://master.php.net/note/delete/118439/non-english
Del: in docs -- https://master.php.net/note/delete/118439/in+docs
Del: other reasons-- https://master.php.net/note/delete/118439
Reject -- https://master.php.net/note/reject/118439
Search -- https://master.php.net/manage/user-notes.php