I need some help with a PHP function I am writing. I need to take input like this:
192.168.1.1-255
or
192.168.1.1/28
and turn it into an array of addresses, such as:
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
...
Here's where I am at (LOL, not far at all):
$remoteAddresses = array('192.168.1.1-255);
foreach($remoteAddresses as &$address) {
if(preg_match('/(.*)(-\n*)/', $address, $matches)) {
$address = $matches[1];
}
}
If anyone has some spare time and wants to help me, I really don't know how I am going to handle the 192.168.1.1/28 syntax...