lamoni/ipsuite

处理IPv4和IPv6地址的PHP实用工具

v1.0.0 2015-02-09 07:40 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:18:19 UTC


README

处理IPv4和IPv6的PHP实用工具

示例

echo IPSuite::GetIPv4NetworkAddress("192.168.0.1/24"); // 192.168.0.0

echo IPSuite::NormalizeIPv6Address("::1"); // 0000:0000:0000:0000:0000:0000:0000:0001

if (IPSuite::IsIPv4SubnetWithinSupernet("192.168.0.0/24", "192.168.0.0/16")) {
    echo "Yes!";
}
else {
    echo "Nope!";
}

if (IPSuite::IsIPv4AddressWithinSubnet("192.168.0.100", "192.168.0.0/24")) {
    echo "Yes!";
}
else {
    echo "Nope!";
}