Calculate whether the PHP script under the same subnet

xiaoxiao2021-03-05  23

/ *

As: 192.16.1.13

&Pending: 255.255.255.0

Perform,, with counted, and require it to 192.16.1.0

* /

$ IP = "192.16.1.13";

Echo get_net ($ IP, "255.255.255.0");

Function GET_NET ($ IP, $ HIDE = "255.255.255.255") {

$ a = evtern (".", $ IP);

$ b = evtern (".", $ hide;

For ($ I = 0; $ i <4; $ i )

$ R [$ I] = (int) $ a [$ I] & (int) $ b [$ I];

Return Join (".", $ R);

}

?>

转载请注明原文地址:https://www.9cbs.com/read-37506.html

New Post(0)