ph_isvalidip PowerHome formula function
Description
Checks that the supplied as_ip string is
a valid IPV4
IP address
Syntax
ph_isvalidip ( as_ip )
Argument | Description |
as_ip | String. An IPV4 address |
Return value
Integer. Returns 0 if as_ip
contains a valid IP address. 1 or 2 is returned (depending upon which check
fails) if as_ip contains any characters that would not be in an IP address
or if as_ip does not meet the format of xxx.xxx.xxx.xxx where "x" is a
number 0 thru 9. Returns 3 if any of the IP segments is out
of the range of
0 to 255.
Usage
This function ONLY checks that the supplied
value in as_ip COULD be a valid IP. It does NOT go out on the network to verify
that the IP address
is reachable.
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_isvalidip("192.168.0.45") -
Returns
0
• ph_isvalidip("256.123.123.55") - Returns
3 because the first IP segment is outside of the range of 0 thru
255