Net_IPv6::isInNetmask() – Checks if an IP is in a specific address space


require_once 'Net/IPv6.php';

boolean Net_IPv6::isInNetmask ( string $ip , string $netmask , int $bits = null )


Checks if an (compressed) IP is in a specific address space. If the IP does not contain the number of netmask bits (for example: F8000::FFFF/16), then you have to use the $bits parameter.


  • string $ip - the IP address in Hex format, compressed IPs are allowed

  • string $netmask - the netmask (for example: F800::)

  • int $bits - if the number of netmask bits is not part of the IP, you must provide the mumber of bits

Return value

boolean - TRUE, if the IP is in the address space.


This function can be called statically.

Method available since: Release 1.1.0

Tests for a prefix length specification in the address and returns the prefix length, if exists. (Previous) Removes the Netmask length specification (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.