Generate an array using your values as the key and just add to it.
$cnt_array = array();
// $data is the array from your message
for ($i = 1; $i <= count($data); $i++) {
$key = $data[$i]["FIELD 1"] . ":" . $data[$i]["FIELD 2"] . ":" . $data[$i]["FIELD 3"];
// Note use something that won't apprear in your data as the delimiter.
if (!isset($cnt_array[$key])) {
$cnt_array[$key] = 1;
}
else {
$cnt_array[$key]++;
}
}
// Now you have an array that has a key of your fields and a count of the matches.
reset($cnt_array);
while (list($key, $value) = each($cnt_array)) {
print $key . " - " . $value;
}
That's it should work fine.