src/includes/classes/Core/Utils/Ip.php
protected function getValidPublicFrom(string $list_of_possible_ips): string
    {
        if (!($list_of_possible_ips = $this->c::mbTrim($list_of_possible_ips))) {
            return ''; // Not possible; i.e., empty string.
        }
        foreach (preg_split('/[\s;,]+/u', $list_of_possible_ips, -1, PREG_SPLIT_NO_EMPTY) as $_possible_ip) {
            if (($_valid_public_ip = filter_var(mb_strtolower($_possible_ip), FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
                return $_valid_public_ip; // A valid public IPv4 or IPv6 address.
            }
        } // unset($_possible_ip, $_valid_public_ip); // Housekeeping.

        return ''; // Default return value.
    }
protected function getValidPublicFrom(string $list_of_possible_ips): string
    {
        if (!($list_of_possible_ips = $this->c::mbTrim($list_of_possible_ips))) {
            return ''; // Not possible; i.e., empty string.
        }
        foreach (preg_split('/[\s;,]+/u', $list_of_possible_ips, -1, PREG_SPLIT_NO_EMPTY) as $_possible_ip) {
            if (($_valid_public_ip = filter_var(mb_strtolower($_possible_ip), FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
                return $_valid_public_ip; // A valid public IPv4 or IPv6 address.
            }
        } // unset($_possible_ip, $_valid_public_ip); // Housekeeping.

        return ''; // Default return value.
    }
Looks for a valid/public IP address.

@since 150424 Initial release.

@param string $list_of_possible_ips A single IP, or a comma-delimited list of IPs.

@return string A valid/public IP address (if one is found); else an empty string.