Hi all,
Ran into a hitch with searching a multi dimensional array. Here is the array.

$playerarray = Array ( [0] => Array ( [Team] => jimmydee2 [Player1] => jimmydee2 ) [1] => Array ( [Team] => jimmydee2 [Player1] => jimmydee2 ) );

here is my code to search it for a variable

foreach($playerarray as $key => $v){
if($v == "$userid"){
do something; // if userid is in array
}
}

I need to see if the variable $userid is anywhere in the array but doesnt seem to be working. Be real happy if you can help me out. Is it syntax or the way I am trying to do it. Or do I use in_array?

Thanks heaps.

    It may be as simple as:

    $found = false;
    foreach ($playerarray as $value) {
        if (in_array($userid, $value)) {
            $found = true;
            break;
        }
    }
      Write a Reply...