note 34593 deleted from function.in-array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:51:46 +0000 |
| Subject: | note 34593 deleted from function.in-array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134468@lists.php.net to get a copy of this message | ||
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;
}