You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't remember why I started doing this... if it was in a doc or comment I read, or if I just noticed it...
I always add the zip I'm searching on to the array before I start.
Here the array $zipList is initialized with only 1 value, the search zip... then a foreach to add all the nearby zips
$zipStuff = new ZipCode($data['zip'], $dbh);
$zipList = array($data['zip']); // start with the array only containing the search zip!
foreach ($zipStuff->getZipsInRange(0, $data['distanceMenu']) as $miles=>$zip) {
$zipList[] = $zip;
Let's say for example I create a new instance of Zipcode and then loop through those results by doing:
$zip = new Zipcode("98674");
foreach ($zip->getZipsInRange(0, 15) as $k => $v) {
$zip_codes[] = sprintf($v);
//print_r($v);
}
The original zip code being searched of 98674 isn't returned with the results.
The text was updated successfully, but these errors were encountered: