<? $test = "www.example.com"; if ( preg_match( "/www\.example(\.com|\.co\.uk)/", $test, $array ) ) { print "it is a $array[1] domain<br/>"; } ?>