note 34593 deleted from function.in-array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: jr at jrmanes dot com 

----

/*
 ** A function that checks to see if a string in an array
 ** exists in a string.
 ** example:
 **   $string = "My name is J.R.";
 **   $array = array("Mike", "Joe", "Bob", "J.R.");
 **   if (arrayinstr($string, $array)) echo "Found it!";
 */

function arrayinstr($haystack, $needle) {
   $foundit = false;
   foreach($needle as $value) {
      if (!strpos($haystack, $value) === false)
         $foundit = true;
   }
   return $foundit;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.