Create list of valid ips in php for a mysql table

0

Good morning, I need to create a list of valid ips from my network. I have 15 class A subnets. That is, my network is 10.5.5.0 by 10.5.20.255 . I was thinking of something like: $IP for (i=1; i<255; i++) do $IP.$i However, in this logic, I would only create ips of class C. This list would be inserted into a mysql table. I look forward to suggestions.

    
asked by anonymous 06.11.2018 / 13:34

1 answer

0
$ip = '10.5.';
for ($redeB=5; $redeB < 21 ; $redeB++) { 
    for ($redeC=1; $redeC < 255; $redeC++) { 
        echo $ip.$redeB.'.'.$redeC.'<br>';
    }
}

The first is to count rede B , the second is to count rede C . The first one is 5 ~ 20 count, inside I've put another one to count 1 ~ 254 , every second B will count as 1 ~ 254 .

    
06.11.2018 / 13:53