[eluser]echoDreamz[/eluser]
Code:
$start = explode('.', $_POST['ipRange1']);
$end = explode('.', $_POST['ipRange2']);
/**
* Final output...
*/
$a = 0;
$b = 0;
$c = 0;
$d = 0;
$total = 0;
// First segment
for ($a = $start[0]; $a < 1 + $end[0]; $a++)
{
// Second segment
for ($b = $start[1]; $b < 1 + $end[1]; $b++)
{
// Third segment
for ($c = $start[2]; $c < 1 + $end[2]; $c++)
{
// Fourth segment
for ($d = $start[3]; $d < 1 + $end[3]; $d++)
{
$total++;
echo "{$a}.{$b}.{$c}.{$d}<br />";
}
}
}
}
The above works fine for ranges like 192.168.1.1 - 192.168.2.254 however for items like 192.168.1.10 - 192.168.2.15 it only lists the 6. I see why it is doing this, I just cant find a way around this.
Thank for the help!