PHP code example of cmdrsharp / ip-addressing
1. Go to this page and download the library: Download cmdrsharp/ip-addressing 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/ */
cmdrsharp / ip-addressing example snippets
use CmdrSharp\IpAddressing\IPv4;
use CmdrSharp\IpAddressing\Subnet;
class RandomClass
{
use IPv4, Subnet;
protected function randomFunction()
{
$result = $this->getNetworkFromIp('192.168.0.55', '255.255.255.0');
// 192.168.0.0
$result = $this->getBroadcastFromIp('192.168.0.55', '255.255.255.0');
// 192.168.0.255
$result = $this->getCidrFromNetmask('255.255.255.0');
// 24
}
}