\mindpowered\iptoolsIPTools

IP Address Conversion and CIDR calculator

Summary

Methods
Properties
Constants
__construct()
SubnetMaskToCIDR()
CalcCIDR()
IPToDecimal()
IP4FromDecimal()
IP6FromDecimal()
IPv4ToIPv6()
ExpandIPv6()
CompressIPv6()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

IPTools

SubnetMaskToCIDR()

SubnetMaskToCIDR(string  $subnet_mask) : object

Convert a subnet mask to CIDR notation

Parameters

string $subnet_mask

A subnet mask eg. 255.255.0.0

Returns

object —

object containing information about subnet including CIDR prefix

CalcCIDR()

CalcCIDR(string  $ip_addr) : array

Given an IP address or IP address with CIDR notation, provides information about an IP address range

Parameters

string $ip_addr

An IP address with or without CIDR notation

Returns

array —

a list of objects containing information about the IP address range

IPToDecimal()

IPToDecimal(string  $ip_addr) : string

Convert an IP address to a Decimal representation

Parameters

string $ip_addr

An IP address

Returns

string —

Decimal representation of the provided IP address

IP4FromDecimal()

IP4FromDecimal(string  $ip4_number) : string

Convert from a Decimal representationan of an IP address

Parameters

string $ip4_number

Decimal representation of an IP address

Returns

string —

The IP address

IP6FromDecimal()

IP6FromDecimal(string  $ip6_number) : string

Convert from a Decimal representationan of an IP address

Parameters

string $ip6_number

Decimal representation of an IP address

Returns

string —

The IP address

IPv4ToIPv6()

IPv4ToIPv6(string  $ip_addr) : object

Convert an IPv4 address to an IPv6 address

Parameters

string $ip_addr

An IPv4 address

Returns

object —

An object containing IPv6 representations of the provided IPv4 address

ExpandIPv6()

ExpandIPv6(string  $ip6_addr) : object

Expand the zeros in an IPv6 address

Parameters

string $ip6_addr

An IPv6 address

Returns

object —

The same IPv6 address with zeros expanded

CompressIPv6()

CompressIPv6(string  $ip6_addr) : object

Compress the zeros in an IPv6 address

Parameters

string $ip6_addr

An IPv6 address

Returns

object —

The same IPv6 address with zeros compressed