public function get_cidr($ip) {
    // extract IP version and number
    list($ipVersion, $ipNumber) = self::ipVersionAndNumber($ip);
    // perform the binary search proper (if the IP address was invalid, binSearch will return false)
    $resp = $this->binSearch($ipVersion, $ipNumber, true);
    if(!empty($resp)) {
      list($ip_from, $ip_to) = $resp;
      $i=32; $mask=1;
      while(($ip_to & $mask) == 0) {
        $mask *= 2; $i--;
      }
      $ip = long2ip($ip_from);
      return "$ip/$i";
    }
    return false;
  }