Blogger Information
Blog 14
fans 0
comment 0
visits 27755
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
获取两个字符串(中文)相同的汉字
花式BUG_beisi
Original
1254 people have browsed it

<?php header('Access-Control-Allow-Origin:*');

$a = explode(',','水,晶,水,组');

var_dump($a);exit;


$a="富培美家庭清洁超值组合之富培美水精灵*6盒(天蓝色/1000g/套)";

$b="20/30/40“百变伊人”黄水晶套组(黄色)";

 

$a1 = mexplode($a);

$b1 = mexplode($b);

 

$res = array_intersect($a1,$b1);

echo '相同汉字数:'.count($res).'<br>';

echo '它们是:'.join(',',$res);

 

function mexplode($str){

    $find = "/[\x{4e00}-\x{9fa5}]/u";

    preg_match_all($find, $str, $m);

    return $m[0];

}


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post