I ran into a issue where the array was undefined/blank when it came back from the zipcode class I had to move up outside the while the new array
maybe this might help someone else..great function!! Needed it for a while now!
//new idea need to move $result outside while
$result = array();
$distance = 24901.55;
while ($closest = tep_db_fetch_array ($closest_query) ) {
$new_distance = $this->get_distance ($closest['postcode'], $destination_postcode);
//old $result = array(); //WAS ON LINE 363? or SO
switch (true) {
case ($new_distance === false):
// There was an error, so ignore this data
break;
case ($new_distance === 0):
// Can't get any closer than that. Return this shipper's information
$result['city'] = $closest['city_name'];
$result['state'] = $closest['state_id'];
$result['country'] = $closest['country_id'];
$result['postcode'] = $closest['postcode'];
return $result;
break;
case ($new_distance < $distance):