ok, put everything in an array...
like this:
<?php
$array = array();
$array[] = "whatever";
$array[] = "dummy";
$array[] = "whatever";
$array[] = "whatever";
$array[] = "too easy";
$count_array = array_count_values ($array);
?>
now $count_array["whatever"] == 3, $count_array["dummy"] == 1, $count_array["too easy"] == 1
so when you are looping through your log files or whatever, just keep adding values to the array, and then count them, or you could just keep the array like this:
<?php
$count_array = array();
// get the country
$count_array[$country]++;
?>
then the end result should be the same thing.