PHP code example of athlon1600 / php-cidr-range-optimizer
1. Go to this page and download the library: Download athlon1600/php-cidr-range-optimizer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
athlon1600 / php-cidr-range-optimizer example snippets
use ProxyNova\RangeOptimizer\CIDRList;
use ProxyNova\RangeOptimizer\RangeOptimizer;
$ranges = CIDRList::fromArray([
"192.168.1.0/26",
"192.168.1.64/27",
"192.168.1.96/27",
"10.1.0.0/26",
"10.1.0.64/26"
]);
// returns new optimized CIDRList object
$optimized = RangeOptimizer::optimize($ranges);
echo $optimized;