public static function validIpv4NotReserved($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty IPv4 address given.");
        }

        if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)) {
            throw new \InvalidArgumentException(
                "Invalid IPv4 address given. Reserved ranges like 240.0.0.0/4 are disallowed."
            );
        }

        return $value;
    }
public static function validIpv4NotReserved($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty IPv4 address given.");
        }

        if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)) {
            throw new \InvalidArgumentException(
                "Invalid IPv4 address given. Reserved ranges like 240.0.0.0/4 are disallowed."
            );
        }

        return $value;
    }
public static function validIpv4NotReserved ( $ value ) { if ( empty ( $ value ) ) { throw new \ InvalidArgumentException ( "Empty IPv4 address given." ) ; } if ( ! filter_var ( $ value , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE ) ) { throw new \ InvalidArgumentException ( "Invalid IPv4 address given. Reserved ranges like 240.0.0.0/4 are disallowed." ) ; } return $ value ; }
Validates the given value using the PHP filter_var with
FILTER_VALIDATE_IP and flag FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE.

@param string $value IP to validate

@return string ipv4 (may still be in private range)

@throws \InvalidArgumentException in case of validation errors (invalid or empty ip)
Validates the given value using the PHP filter_var with FILTER_VALIDATE_IP and flag FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE .