Net_IPv4::ipInNetwork()
Net_IPv4::ipInNetwork() –
Determines whether or not the supplied IP is within the supplied
network.
Synopsis
require_once 'Net/IPv4.php';
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.