Archive

Posts Tagged ‘FILTER_FLAG_NO_PRIV_RANGE’

Validating IP Addresses Using PHP

October 5th, 2009

PHP 5.2+ offer an excellent function for validating IP Addresses: filter_var().

The filter_var() function offers several flags: FILTER_VALIDATE_IP, FILTER_FLAG_IPV4, FILTER_FLAG_IPV6, FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE, used to filter or validate IP addresses based on whether the address is IPv4, IPv6 or within a reserved or private network range.

Read more…

involvement-disturbing