Created
December 9, 2013 02:41
-
-
Save tbaschak/7866668 to your computer and use it in GitHub Desktop.
calculate network address given IP & Netmask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// simple example | |
$bcast = ip2long("192.168.178.41"); | |
$smask = ip2long("255.255.255.0"); | |
$nmask = $bcast & $smask; | |
echo long2ip($nmask); // Will give 192.168.178.0 | |
echo "\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment