Home >php教程 >php手册 >php源码分析之DZX1.5字符串截断函数cutstr用法

php源码分析之DZX1.5字符串截断函数cutstr用法

WBOY
WBOYOriginal
2016-06-06 20:03:201142browse

这篇文章主要介绍了php源码分析之DZX1.5字符串截断函数cutstr用法,实例分析了DZX1.5中cutstr函数实现字符串截取的使用技巧,需要的朋友可以参考下

本文实例讲述了php源码分析之DZX1.5字符串截断函数cutstr用法。分享给大家供大家参考。具体分析如下:

= $length) { break; } } if($noc > $length) { $n -= $tn; } $strcut = substr($string, 0, $n); } else { for($i = 0; $i 127 ? $string[$i].$string[++$i] : $string[$i]; } } $pos = strrpos($strcut, chr(1)); if($pos !== false) { $strcut = substr($strcut,0,$pos); } return $strcut.$dot; } $string = '测试数据库ablci102020@(#)!)!测试劳动力ddk'; echo cutstr($string,15); /*End of php*/

运行结果如下:

测试数据库ablci1020...

希望本文所述对大家的php程序设计有所帮助。

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