I need help to detect when a string contains 4-byte characters using PHP. Is there a built in function or regex that can efficiently do this?
I have found this article that talks about replacing, but I cannot find a working example that just detects.
Can php detect 4-byte encoded utf8 chars?
This is about as far as I got but it fails too:
$chars = str_split($term);
foreach ($chars as $char) {
if (strlen($char) >= 4) {
print "Found 4-byte character\n";
}
}