vB_Ip
in package
Uses
vB_Trait_NoSerialize
Table of Contents
- IPV4_REGEX = '(\d{1,3})(?:\.(\d{1,3})){3}'
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- areIpsEqual() : bool
- Determines if the IPS are the same. Note that this should work ccross different formats
- getIpFields() : mixed
- Gets ip fields for storage from a string representation of IP. If the IP string is invalid it returns false.
- ipInArray() : bool
- Determines if the ip is one of the IPs are the same based on the rules for areIpsEqual
- isValidIPv4() : bool
- Validates an IPv4 address
- validateIPv6() : mixed
- Validates an IPv6 string representation and returns the ip fields for storage. If representation is invalid it returns false.
Constants
IPV4_REGEX
public
mixed
IPV4_REGEX
= '(\d{1,3})(?:\.(\d{1,3})){3}'
Methods
__serialize()
public
__serialize() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —__unserialize()
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —areIpsEqual()
Determines if the IPS are the same. Note that this should work ccross different formats
public
static areIpsEqual(string $ip1, string $ip2) : bool
Note that if either ip address string is invalid the function will always return false.
Assumes the ip values are both strings
Parameters
- $ip1 : string
- $ip2 : string
Return values
bool —getIpFields()
Gets ip fields for storage from a string representation of IP. If the IP string is invalid it returns false.
public
static getIpFields(string $ipAddress) : mixed
Parameters
- $ipAddress : string
Return values
mixed —ipInArray()
Determines if the ip is one of the IPs are the same based on the rules for areIpsEqual
public
static ipInArray(mixed $ip, array<string|int, mixed>|(string) $iparray) : bool
Assumes the ip values are all strings
Parameters
- $ip : mixed
- $iparray : array<string|int, mixed>|(string)
Return values
bool —isValidIPv4()
Validates an IPv4 address
public
static isValidIPv4(string $ipAddress) : bool
Parameters
- $ipAddress : string
Return values
bool —validateIPv6()
Validates an IPv6 string representation and returns the ip fields for storage. If representation is invalid it returns false.
public
static validateIPv6(string $ipAddress) : mixed
Parameters
- $ipAddress : string