Ok - your problem is around the use of array_push... this whole block of code in all: -
if (!$global[$area]) {
array_push($global, $area);
$global[$area] = $hits;
}else{
$global[$area] = ($global[$area] + $hits);
}
Reading the manual tells us that array_push(array, value) is the same as array[] = value - i.e a new integer based key will be created and the value assigned to that, i.e.
$array = array();
array_push($array, "one");
array_push($array, "two");
array_push($array, "three");
.. will leave us with the array
$array[0] = "one"
$array[1] = "two"
$array[2] = "three"
You then seem to apply a string key based assignment - $global[$area] = $hits; - which is assigning a string based key (since the value "01" (or whatever) is string based and not an integer (1), so a new key will be created in this place.
If you followed this all ok then the answer should be fairly obvious - but all you need to do to rectify this is to remove the array_push line. If you try and assign a value to a key in the array which doesnt exist then php will just create it on the fly for you, no need for array_push at all (in this case anyhow). So the rectified code shud probably lok something like: -
if (!$global[$area]) {
$global[$area] = $hits;
}else{
$global[$area] = ($global[$area] + $hits);
}
Hope this helps!