I may be doing it wrong but take a peek. If I hardcode the logic, it works but not if I try to use it as a variable.\[code\]if($range <= 50) { $operator = "<=";} else { $operator = ">=";}foreach($cursor as $s) { $data = http://stackoverflow.com/questions/2074308/round($this->distance($zip_lat, $zip_lon, $s["lat"],$s["lon"]), 2); if ($data .$operator. $range) { $zipcodes[] = "$s[zipcode]"; }} \[/code\]I mean, I could add the if/else inside the foreach but wasn't sure if it adds any "overhead."