/usr/share/doc/php-net-ipv6/examples/sample.php is in php-net-ipv6 1.3.0b1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | <?php
include ("Net/IPv6.php");
function show_example($obj, $arr)
{
foreach ($arr AS $key=>$val)
{
list ($param, $rettype) = $val;
print "\n";
print "<b>\$netipv6->{$key}($param)</b>\n";
print "--------------------------------------------------------------------------\n";
($rettype == "string") ? print $obj->{$key}($param) : false;
($rettype == "array") ? var_dump($obj->{$key}($param)) : false;
print "\n";
print "\n";
}
}
//
// Engine
//
$netipv6 = new Net_IPv6();
$ip = "fe80::21b:eedf:0:eff2";
$pl = "64";
(array) $arr_examples = array(
"separate" => array("$ip/$pl", "array"),
"removePrefixLength" => array("$ip/$pl", "string"),
"getNetmaskSpec" => array("$ip/$pl", "string"),
"getPrefixLength" => array("$ip/$pl", "string"),
"getNetmask" => array("$ip/$pl", "string"),
//"isInNetmask" => array(),
"getAddressType" => array("$ip", "string"),
"uncompress" => array("$ip", "string"),
"compress" => array("$ip", "string"),
"recommendedFormat" => array("$ip", "string"),
//"isCompressible" => array("$ip", "string"),
"SplitV64" => array("$ip/$pl", "array"),
"checkIPv6" => array("$ip", "string"),
"parseAddress" => array("$ip/$pl", "array"),
"_ip2Bin" => array("$ip", "string"),
"_bin2Ip" => array("$ip", "string"),
);
print "<pre>\n";
show_example($netipv6, $arr_examples);
print "</pre>\n";
?>
|