PHP chunk_split() 函数
PHP 教程
· 2019-01-29 10:57:27
实例
在每个字符后分割一次字符串,并在每个分割后添加 ".":
<?php
$str = "Hello world!";
echo chunk_split($str,1,".");
?>
$str = "Hello world!";
echo chunk_split($str,1,".");
?>
定义和用法
chunk_split() 函数把字符串分割为一连串更小的部分。
注释:该函数不改变原始字符串。
语法
chunk_split(string,length,end)
| 参数 | 描述 |
|---|---|
| string | 必需。规定要分割的字符串。 |
| length | 可选。一个数字,定义字符串块的长度。默认为 76。 |
| end | 可选。一个字符串,定义在每个字符串块之后放置的内容。默认为 \r\n。 |
技术细节
| 返回值: | 返回已分割的字符串。 |
|---|---|
| PHP 版本: | 4+ |
更多实例
实例 1
在每六个字符后分割一次字符串,并在每个分割后添加 "...":
<?php
$str = "Hello world!";
echo chunk_split($str,6,"...");
?>
$str = "Hello world!";
echo chunk_split($str,6,"...");
?>
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
Algorithms in Java, Part 5
Robert Sedgewick / Addison-Wesley Professional / 2003-7-25 / USD 54.99
Algorithms in Java, Third Edition, Part 5: Graph Algorithms is the second book in Sedgewick's thoroughly revised and rewritten series. The first book, Parts 1-4, addresses fundamental algorithms, data......一起来看看 《Algorithms in Java, Part 5》 这本书的介绍吧!