English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP chunk_split() Function Usage and Example

PHP String String Function Manual

The chunk_split() function is used to split the string into small pieces

Syntax

string chunk_split( string $body[, int $chunklen = 76 [, string $end = "\r\n"] )

Definition and Usage

It is used to split the string into smaller blocks

Return Value

It returns the split string

Parameter

NumberParameters and Description
1

body

Character to be Split

2

chunklen

Split Size

3

end

 End of Line Sequence Symbol.

Online Example

Try the following example, split w3codebox split the string after each character and add "." after each split

<?php
   //Split w3codebox split the string into individual characters and add "." after each split
   $str = "w3
   echo chunk_split($str,1,".");
?>
Test and See‹/›

Output Result

n.h.o.o.o.

PHP String String Function Manual