function ipVer ( $ipWithSubnet )
{
	list($ip, $subnetMask) = explode('/', $ipWithSubnet);

	$ipLong = ip2long($ip);
	$subnetMaskLong = -1 << (32 - $subnetMask);
	$networkAddress = $ipLong & $subnetMaskLong;
	$broadcastAddress = $networkAddress | ~$subnetMaskLong;

	$availableIPs = array();
	for ($i = $networkAddress + 1; $i < $broadcastAddress; $i++) 
	{
		$availableIPs[] = long2ip($i);
	}

	return $availableIPs;
}

$ipWithSubnet = "212.68.54.128/28";
print_r ( ipVer ( $ipWithSubnet ) );
Categories: PHP language

53 Comments

เว็บปั้มไลค์ ราคาถูก · 23/08/2025 at 00:15

… [Trackback]

[…] Read More here on that Topic: durukanbal.com/2023/04/15/php-ip-subnet-calculator/ […]

78win · 31/08/2025 at 01:22

… [Trackback]

[…] Here you can find 46296 more Information to that Topic: durukanbal.com/2023/04/15/php-ip-subnet-calculator/ […]

new88 · 01/09/2025 at 00:53

… [Trackback]

[…] Find More Info here on that Topic: durukanbal.com/2023/04/15/php-ip-subnet-calculator/ […]

Leave a Reply

Avatar placeholder