- preg_match: documentation ( source)
- print_r: documentation ( source)
<?php
// Everything you enter here will be executed by our servers. Try it!
$domain = "stackoverflow.com";
$uriToTest = "http://stackoverflow.com/";
$pattern = "/^http(s)?:\//(([a-z]+)\.)*".$domain."/";
print_r( preg_match($pattern, $uriToTest));