<?php
$emails = array(
	"Dkstu@studio.com.tw",
	"Dkstu@studio.com.tw​"
);

echo " Test1 => " . (($emails[0] === $emails[1])? "Same" : "Diff") . "\n" ;

echo "-- Check Length --\n"
. "LENGTH: ". strlen($emails[0]) . " => " . implode(":", utf8_str_split($emails[0])) . "\n" 
. "LENGTH: ". strlen($emails[1]) . " => " . implode(":", utf8_str_split($emails[1])) . "\n" ;

echo "- - - - - - - - - - - - - - - - - - -\n";
($emails[0]=clear_utf8 ($emails[0])) && ($emails[1]=clear_utf8 ($emails[1])); // 去除中文(UTF-8)空格

echo " Test2 => " . (($emails[0] === $emails[1])? "Same" : "Diff") . "\n" ;

echo "-- Check Length --\n"
. "LENGTH: ". strlen($emails[0]) . " => " . implode(":", utf8_str_split($emails[0])) . "\n" 
. "LENGTH: ". strlen($emails[1]) . " => " . implode(":", utf8_str_split($emails[1])) . "\n" ;




function utf8_str_split($str, $split_len = 1) {
    if (!preg_match('/^[0-9]+$/', $split_len) || $split_len < 1)
        return FALSE;
 	$len = mb_strlen($str, 'UTF-8');
    if ($len <= $split_len)
        return array($str);
    preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar);
    return $ar[0];
}

function clear_utf8 ($str) {
	return preg_replace('/([\x80-\xff]*)/i', '', $str);
}