note 34593 added to function.in-array

From: Date: Thu, 31 Jul 2003 16:35:06 +0000
Subject: note 34593 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-53097@lists.php.net to get a copy of this message
/* ** 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; } ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34593 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34593&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34593&report=yes

« previous php.notes (#53097) next »