note 110332 deleted from function.in-array by googleguy
| From: | googleguy@php.net | Date: | Fri, 12 Oct 2012 01:50:10 +0000 |
| Subject: | note 110332 deleted from function.in-array by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191258@lists.php.net to get a copy of this message | ||
Note Submitter: msmail2 at gmx dot de
----
This worked best for me (had an array a needle with the integer 0 and in_array always found 0 in my
empty array.
function isInArray($needle, $myArray){
$found = false;
for($i=0;$i<count($myArray);$i++){
if (strcmp($myArray[$i],$needle)==0){
$found = true;
break;
}
}
return $found;
}