25 $length = strlen($string);
26 if ($string ===
'')
return '';
27 if ($length > 1 && $string[0] ===
'[' && $string[$length-1] ===
']') {
29 $ip = substr($string, 1, $length - 2);
31 if (
$valid ===
false)
return false;
36 $ipv4 = $this->ipv4->validate($string,
$config, $context);
50 $domainlabel =
"$an($and*$an)?";
52 $toplabel =
"$a($and*$an)?";
54 $match = preg_match(
"/^($domainlabel\.)*$toplabel\.?$/i", $string);
55 if (!$match)
return false;