Oihana PHP Arango

isIPV4.php

Table of Contents

Functions

isIPV4()  : string
Check if an arbitrary string is suitable for interpretation as an IPv4 address.

Functions

isIPV4()

Check if an arbitrary string is suitable for interpretation as an IPv4 address.

isIPV4(string $value) : string

This helper wraps the ArangoDB AQL function IS_IPV4(value) which checks whether the given string is a valid IPv4 address in dotted decimal notation.

Example AQL usage:

IS_IPV4("127.0.0.1")         // returns true
IS_IPV4("192.168.0.1")       // returns true
IS_IPV4("256.0.0.1")         // returns false (invalid octet)
IS_IPV4("not an ip")         // returns false
Parameters
$value : string

String expression to validate as IPv4 address.

Tags
example
use function oihana\arango\db\functions\strings\isIPV4;

$expr = isIPV4('doc.ipAddress');
// Produces: 'IS_IPV4(doc.ipAddress)'
see
https://docs.arangodb.com/stable/aql/functions/string/#is_ipv4
ipv4FromNumber()

For converting numeric to string IPv4.

ipv4ToNumber()

For converting string to numeric IPv4.

since
1.0.0
author

Marc Alcaraz

Return values
string —

The formatted AQL expression.

On this page

Search results