All pastes #108348 Raw Edit

Untitled

public php v1 · immutable
#108348 ·published 2006-07-31 13:08 UTC
rendered paste body
// get host name from URLpreg_match("/^(http:\/\/)?([^\/]+)/i", "http://chezmoi.aol.ca/beitaqu/now322836.html", $matches);$host = $matches[2];// get last two segments of host namepreg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);echo "domain name is: {$matches[0]}\n";//The above works fine. It appears the when I give preg_match a direct source for the pattern to match it works, but giving it an //array doesn't work as show below:// get host name from URLpreg_match("/^(http:\/\/)?([^\/]+)/i", $linkarray[1][$i], $matches);$host = $matches[2];// get last two segments of host namepreg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);echo "domain name is: {$matches[0]}\n";//This doesn't give a result.