PHP chunk_split() Function

PHP chunk_split() function is used to splits a string into smaller parts or chunks. The function does not alter the original string.

Syntax:

ParameterDescriptionRequired/Optional
stringString to splitRequired
LengthSpecify the length of the chunks. Default is 76Optional
endSpecify what to place at the end each chunk.Optional

Example 1

Output:

Hello ...javatp...oint!...

Example 2

Output:

Your string is: Hello
By using 'chunk_split()' function your string is: H.e.l.l.o.

Next TopicPHP String




Latest Courses