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
--
PHP General Mailing List (http://www.php.net/)
To
dont know of a function but this should work
$size = count($array);
for($i=0;$i$size;$i++){
if($selected_person == $array[$i]){
echoindex: $i;
}
}
Adrian
Ross wrote:
Hi,
I have an array
$people= array (ross, bob, chris)
I have a variable
$selected_person = chris
I want to
Hi,
just take a look at this function:
http://www.php.net/manual/en/function.array-keys.php
__
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
--
PHP General
3 matches
Mail list logo