sample array:
$team = array(
    array(
        "cid" => 123,
        "pid" => 000,
        .
        .
    ),
    array(
        "cid" => "666",
        "pid" => "000",
        .
        .
    ),
    array(
        "cid" => "777",
        "pid" => "123",
        .
        .
    ),
    array(
        "cid" => "888",
        "pid" => "123",
        .
        .
    ),
    array(
        "cid" => "999",
        "pid" => "777",
        . 
        .
    ),
    .
    .
);
I have a similar array with 100 Thousands of data. When I search for a data using a foreach or for loop it takes lot of time. Is there any better way to do it?
Suppose I want to find out all the cid where pid = 123.
 
     
    