Home >php教程 >php手册 >PHP截取中文字符串方法新写的

PHP截取中文字符串方法新写的

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-22 18:36:07988browse

<?php
function entities_rtrim($string, $length) {
    if ($length >= strlen($string)) {
        return $string;
    }
    $s = "";
    for ($i = 0; $i < $length; $i) {
        if (ord($string{$i}) > 127) {
            $s.= $string{$i} . $string{$i};
            continue;
        } else {
            $s.= $string{$i};
            continue;
        }
    }
    return $s;
}


本文链接:

收藏随意^^请保留教程地址.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn