note 30167 deleted from function.array-search by jsheets

From: Date: Sun, 09 Mar 2003 15:24:59 +0000
Subject: note 30167 deleted from function.array-search by jsheets
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-45032@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; }

« previous php.notes (#45032) next »