function searchForId($id, $array) { foreach ($array as $key => $val) { if ($val['uid'] === $id) { return $key; } } return null; }