bool ipInNetwork (
string $ip
, string $cidr_block
)
Determines whether or not the supplied IP address is within the supplied network.
Checking if a IP adress is contained in a network
<?php
require 'Net/IPv4.php';
$ip = '10.11.12.13';
$net1 = '10.0.0.1/8';
$net2 = '127.0.0.1/8';
echo Net_IPv4::ipInNetwork($ip, $net1) // bool(true)
echo Net_IPv4::ipInNetwork($ip, $net2) // bool(false)
?>
This function can be called statically.