Home  >  Article  >  Backend Development  >  Introduction to the usage of chunk_split() function in php

Introduction to the usage of chunk_split() function in php

WBOY
WBOYOriginal
2016-07-25 08:58:151656browse
This article introduces the usage of the chunk_split() function in PHP. Friends in need can refer to it.

Definition and usage chunk_split function splits a string into a series of smaller parts.

Grammar chunk_split(string,length,end)

Parameter Description string required. Specifies the string to be split. length is optional. A number defining the length of the string block. end is optional. A string value that defines what is placed after each string block.

Tips and Notes Note: This function does not change the original string.

Example 1, separate each character and add ".":

Output: H.e.l.l.o. .w.o.r.l.d.!.

Example 2, split the string once after six characters and add "...":

Output: Hello...world!...



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