0

I am using ip2long to calculate the subnet address, broadcast address, and wildcard mask and It´s works but I need to calculate +1 ip address from an specific ip address for example 10.10.10.7 I need to sum +1 ip address and get 10.10.10.8

I am using this code to calculate subnet... but I don´t know if is possible to get It.

$ip='10.10.10.7'; 
$mask='255.255.255.0';
$wcmask=long2ip( ~ip2long($mask) );
$subnet=long2ip( ip2long($ip) & ip2long($mask) );
$bcast=long2ip( ip2long($ip) | ip2long($wcmask) );

//I need to get It
//$ip_+1=$ip + 1;
htmlpower
  • 169
  • 1
  • 16
  • 1
    Not enough rep, but have you checked https://stackoverflow.com/questions/1963623/interested-in-making-a-php-script-that-increments-ip-address-from-defined-starti It’s basically the same – Mpie Feb 16 '19 at 18:44
  • 1
    Possible duplicate of [Interested in making a PHP script that increments IP address from defined starting address to defined ending address](https://stackoverflow.com/questions/1963623/interested-in-making-a-php-script-that-increments-ip-address-from-defined-starti) – Koen Hollander Feb 16 '19 at 19:57

0 Answers0