Testing if a network in cidr notation overlaps another network
问题 I'm searching for a php algorithm that efficiently test if one cidr notated network overlaps another. Basically I have the following situation: Array of cidr adresses: $cidrNetworks = array( '192.168.10.0/24', '10.10.0.30/20', etc. ); I have a method that adds networks to the array, but this method should throw an exception when a network is added that overlaps with a network allready in the array. So ie. if 192.168.10.0/25 is added an exception should be thrown. Does anyone have/know/"can