25 pers. connectées au site
Manuel Pear
Net_IPv4::calculate()
Net_IPv4::calculate() -- Calculates network information based on an IP address and netmask.
Synopsis
- <?php
- require_once 'Net/IPv4.php
- ?>
mixed calculate ()
Description
Fully populates the object properties based on the IP address and netmask/bitmask properties. Once these two fields are populated, calculate() will perform calculations to determine the network and broadcast address of the network.
Exemple
Exemple 54-1. Calculating broadcast and network address
- <?php
-
- require 'Net/IPv4.php';
-
- $ip_calc = new Net_IPv4();
-
- $ip_calc->ip = "192.168.1.10";
- $ip_calc->netmask = "255.255.255.0";
-
-
-
- $error = $ip_calc->calculate();
- if (!is_object($error))
- {
- echo "Your network address: ".$ip_calc->network."<br />";
- echo "Your broadcast address: ".$ip_calc->broadcast."<br />";
- }
- else
- {
- echo "An error occured: ".$error->getMessage();
- }
-
-
- ?>
|
Valeur retournée
boolean - Retourne TRUE en cas de succès, un objet PEAR_Error en cas d'échec.
Note
Cette fonction ne peut pas être appelée de façon statique.
Remonter