\phpWTL\ToolsipTools

Toolbox for IP address related functions

Summary

Methods
Properties
Constants
isIP4()
isIP6()
ipAnon()
No public properties found
IP4_ANON_CUT
IP6_ANON_CUT
IP4_ANON_WC
IP6_ANON_WC
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

IP4_ANON_CUT

IP4_ANON_CUT

Default number of rightmost segments in ip4 address to anonymize

IP6_ANON_CUT

IP6_ANON_CUT

Default number of rightmost segments in ip6 address to anonymize

IP4_ANON_WC

IP4_ANON_WC

Default wildcard character for substitution of anonymized parts in ip4 address

IP6_ANON_WC

IP6_ANON_WC

Default wildcard character for substitution of anonymized parts in ip6 address

Methods

isIP4()

isIP4(string  $ip) : boolean

Checks if given string is syntactically an ip4 address

Parameters

string $ip

The IP address to check.

Returns

boolean —

true if address is ip4.

isIP6()

isIP6(string  $ip) : boolean

Checks if given string is syntactically an ip6 address

Parameters

string $ip

The IP address to check.

Returns

boolean —

true if address is ip6.

ipAnon()

ipAnon(string  $ip, array  $params = null) : string

Anonymize a given IP address (ip4 or ip6)

Parameters

string $ip

The IP address to be anonymized.

array $params

Parameter: ip4cut / ip6cut = Number of rightmost segments in address to anonymize, ip4wildcard / ip6wildcard = character for substitution of anonymized parts

Returns

string —

anonymized IP.