note 24547 added to function.in-array
| From: | leighnus at mbox dot com dot au | Date: | Wed, 21 Aug 2002 04:18:29 +0000 |
| Subject: | note 24547 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35291@lists.php.net to get a copy of this message | ||
Alternative method to find an array within an array (if your version of php doesn't support
array type $needles):
function array_in_array($needle, $haystack) {
foreach ($haystack as $value) {
if ($needle == $value)
return true;
}
return false;
}
--
http://www.php.net/manual/en/function.in-array.php
http://master.php.net/manage/user-notes.php?action=edit+24547
http://master.php.net/manage/user-notes.php?action=delete+24547
http://master.php.net/manage/user-notes.php?action=reject+24547