字符串匹配和汉字长度算法

<?php
header("Content-Type: text/html;charset=utf-8");
$time1=microtime(true);
$s="文搏";
echo $s;
for ($i=0; $i <strlen($s) ; $i++) {
$match.=$s[$i]."(.*)";
}
echo iconv_strlen($s,"UTF-8");
echo $match;
$result=preg_match("/".$s."/", "刘文搏");
var_dump($result);
$time2=microtime(true);
// echo $time2;
// echo $time1;
echo ($time2-$time1);
?>

posted on 2015-10-14 13:40  liuwenbohhh  阅读(173)  评论(0)    收藏  举报