Re: selected index
| From: | Adrian Bruce | Date: | Tue, 25 Oct 2005 11:54:22 +0000 |
| Subject: | Re: selected index | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224618@lists.php.net to get a copy of this message | ||
dont know of a function but this should work
$size = count($array);
for($i=0;$i<$size;$i++){
if($selected_person == $array[$i]){
echo"index: $i";} } Adrian Ross wrote:
Hi, I have an array $people= array ("ross", "bob", "chris") I have a variable $selected_person = "chris" I want to do the find out the index of the $selected_person in the $people array. Is there a function that can do this?? ta, Ross