4

validatehostname

validate_host_name
SYNOPSIS

validate_host_name($host)

DESCRIPTION

validate_host_name returns true if $host is a valid host name, false otherwise.

CODE
  1. function validate_host_name($host) {
  2.     return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host);
  3. }

Comments

To add a comment, click here.