首页 > 代码库 > PHP字符串反转

PHP字符串反转

function getRev($str,$encoding=‘utf-8‘){
        $result = ‘‘;
        $len = mb_strlen($str);
        for($i=$len-1; $i>=0; $i--){
            $result .= mb_substr($str,$i,1,$encoding);
        }
        return $result;
    }

 

PHP字符串反转