ICh versteh das nicht !!! eigentlich sollte 'true' rauskommen, weil news. enthalten ist, aber es gibt mir ein 'false' WARUM !?!??!?!???!?
:
<?php
$c = "http://www.news.at";
$kword = "news";
//Nr. 29/domain_from_url
// get host name from URL
preg_match('@^(?:http://%7chttps//)?([^/]+)@i',
$c, $matches);
$host = $matches[1]; // cut http/s
//print $matches[1];
// get last two segments of host name
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
print_r ($matches);
echo ": {$matches[0]}<br />";
if (@preg_match($matches[0], $kword)) {
echo 'true';
}
else {
echo 'false';
}
?>