note 30167 added to function.array-search
| From: | nostril at rack1 dot php dot net | Date: | Sun, 09 Mar 2003 01:56:59 +0000 |
| Subject: | note 30167 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45023@lists.php.net to get a copy of this message | ||
For some strange reason there are these problems with the<br> array_search function, which
makes it simply usless! Here are my functions
This one returns the position if the element is in the array:
function findInArray($val, $ary)
{
for($i=0; $i < count($ary); $i++)
{
if($val == $ary[$i])
{
return $i;
}
}
return false;
}
And this one only returns true/false if the elem is in the array or not:
function aryElemExists($val, $ary)
{
for($i=0; $i < count($ary); $i++)
{
if($val == $ary[$i])
{
return true;
}
}
return false;
}
--
http://www.php.net/manual/en/function.array-search.php
http://master.php.net/manage/user-notes.php?action=edit+30167
http://master.php.net/manage/user-notes.php?action=delete+30167
http://master.php.net/manage/user-notes.php?action=reject+30167