PHP code example of lamoni / ipsuite

1. Go to this page and download the library: Download lamoni/ipsuite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lamoni / ipsuite example snippets


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!";
}