function mb_strrev($str,$encoding='UTF-8'){
$length = mb_strlen($str,$encoding);
$str_ = '';
for ($i = $length; $i >= 0; $i--) {
$str_ .= mb_substr($str,$i,1,$encoding);
}
return $str_;
}
function mb_strrev2($str,$encoding='UTF-8'){
$length = mb_strlen($str,$encoding);
$arr = [];
for ($i=0; $i < $length; $i++) {
$arr[$i] = mb_substr($str,$i,1,$encoding);
}
return implode(array_reverse($arr));
}
中文字符串反转
最新推荐文章于 2021-03-20 20:58:46 发布