22 pers. connectées au site
Manuel Pear
Net_IPv4::ipInNetwork()
Net_IPv4::ipInNetwork() -- Determines whether or not the supplied IP is within the supplied network.
Synopsis
- <?php
- require_once 'Net/IPv4.php
- ?>
bool validateIP (string $ip_addr, string $cidr_block)
Description
Determines whether or not the supplied IP address is within the supplied network.
Exemple
Exemple 54-1. 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)
- echo Net_IPv4::ipInNetwork($ip, $net2)
-
- ?>
|
Note
Cette fonction peut être appelée de façon statique.
Remonter