function make32s($ip) { if (strpos($ip, "-")) { $ip = IPTools::breakrange($ip); } elseif (strpos($ip, "/")) { $ip_info = IPTools::cidrinfo($ip); $range = $ip_info['RANGE_START'] . "-" . $ip_info['RANGE_END']; $ip = IPTools::breakrange($range); } else { $ip = $ip; } return $ip; }
<?php require "../IPTools.class.php"; $range = "192.168.1.1-192.168.1.10"; $ips = IPTools::breakrange($range); print_r($ips);