title: PHP Find IP Range Overlap
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/149577/need-an-algorithm-for-collapsing-netblock-ranges-into-lists-of-superset-ranges">need an algorithm for collapsing netblock ranges into lists of superset ranges</a>  </p>
  </blockquote>
  
  
  
  <p>In PHP, I have a file with IPs in the following format:</p>
  
  <ol>
  <li>x.x.x.x (single ip)</li>
  <li>x.x.x.x/x (CIDR)</li>
  <li>x.x.x.x-x.x.x.x (ip range)</li>
  </ol>
  
  <p>where each x is 0 to 255.</p>
  
  <p>I would like to make a PHP file to optimize this into a list of IP ranges with the least number of ranges possible (join overlapping entries).</p>