Mega Code Archive

 
Categories / Php / Strings
 

Combine patterns with the pipe () character to create branches

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