Reference Manuals

IPAddress

IPAddress — A simple IP address class that works with IPv4 and IPv6

IPAddress is part of the User package.

Synopsis

class IPAddress {
        public         string              $address
        public         int                 $prefix

        public         IPAddress           __construct               ( string $address );
        public         string              __toString                ( void );
}

Object Hierarchy

IPAddress

Description

A simple IP address class that works with IPv4 and IPv6

Attribute Details

$address

public         string         $address

The fully expanded IPv6 address

Default value: empty string


$prefix

public         int            $prefix

The number of prefix bits. 128 means a single, unique IPv6 address

Default value: empty string

Method Details

__construct()

public         IPAddress      __construct               ( string $address );

Create a new IPAddress instance

$address
An IPv4 or IPv6 address. If no address is given, it results in ::0 (all zeroes)

__toString()

public         string         __toString                ( void );

Convert the IP address to a string. If it's an IPv4 address, it will be displayed as such.