note 123840 added to function.ip2long
| From: | schat@php.net | Date: | Fri, 10 May 2019 11:20:36 +0000 |
| Subject: | note 123840 added to function.ip2long | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211003@lists.php.net to get a copy of this message | ||
sorry i just wrote wrong, sorry. this is the right one. thanks.
/**
* convert cidr to ip range
* From: <https://github.com/www-schat-top>
* @param string $cidr "192.168.0.0/23"
* @return array ["192.168.0.0", "192.168.1.255"]
*/
function cidr2range($cidr){
list( $subnet, $mask ) = explode( '/', $cidr );
return [$subnet, long2ip(ip2long( $subnet ) | (pow(2,( 32 - $mask ))-1))];
}
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.130.26 (proxied: 134.159.87.177)
----
Manual Page -- http://php.net/manual/en/function.ip2long.php
Edit -- https://master.php.net/note/edit/123840
Del: integrated -- https://master.php.net/note/delete/123840/integrated
Del: useless -- https://master.php.net/note/delete/123840/useless
Del: bad code -- https://master.php.net/note/delete/123840/bad+code
Del: spam -- https://master.php.net/note/delete/123840/spam
Del: non-english -- https://master.php.net/note/delete/123840/non-english
Del: in docs -- https://master.php.net/note/delete/123840/in+docs
Del: other reasons-- https://master.php.net/note/delete/123840
Reject -- https://master.php.net/note/reject/123840
Search -- https://master.php.net/manage/user-notes.php