function searchForPlayer($id, $array) {
foreach ($array as $key => $val) {
if ($val['account_id'] == $id) {
return $key;
}
}
return null;
}
EDIT: Based in you edit your array structure, you can call the method for each element in the main array.
function mainSearchForPlayer($id, $mainArray) {
foreach($array as $k => $val) {
$result = searchForPlayer($id, $val);
if($result) break;
}
return $result;
}
And then call:
$player = mainSearchForPlayer($accountid, $array);
=== in php compare by type too this mean if you pass '1' and your id in array is 1 , never be equals
otherwise you can check the types by this way:
var_dump($accountid);
and if this is a string value , you can parse to int:
$accountid = intval($accountid)