I'm basically making a script which analyzes domains and part of this is getting their "anchor texts" and seeing whether these strings contain any Chinese symbols.
I'm using this code but it doesn't seem to work:
foreach ($anchors as $anchor) {
// echo $anchor;
if (preg_match("/\p{Han}+/u", $anchor))
$chinese_flag = 1;
if($chinese_flag == 1):
echo "Found Chinese anchor in: " . $anchor;
break;
endif;
}
When trying to echo out each anchor, I can clearly see that some of the anchors use Chinese symbols such as 中文网站100强 (just giving an example). What am I doing wrong here?
P.S. I've also tried some other RE that I found on stack overflow but none seem to work in my case.