Created
May 20, 2016 06:28
-
-
Save proclnas/56ffc9e1e41e504a93f6cddc8b6f6253 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
function ipRange($startIp, $endIp) { | |
$startIp = ip2long($startIp); | |
$endIp = ip2long($endIp); | |
$ips = range($startIp, $endIp); | |
return array_map('long2ip', $ips); | |
} | |
echo '<pre>'; | |
var_dump(ipRange('192.168.0.1', '192.168.0.10')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Improved method using generator in the php-utils::Network:
Network