HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

chunk_split

Description

The chunk_split of String for PHP split a string into smaller chunks.

Syntax

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

Parameters

body

The string to be chunked.

chunklen

The chunk length.

end

The line ending sequence.

Return

Returns the chunked string.

Examples

1 · body

<?

$body = '12345';

$return = chunk_split($body);
echo $return;
12345

2 · chunklen

<?

$body = '12345';
$chunklen = 2;

$return = chunk_split($body, $chunklen);
echo $return;
12
34
5

3 · end

<?

$body = '12345';
$chunklen = 2;
$end = ',';

$return = chunk_split($body, $chunklen, $end);
echo $return;
12,34,5,

4 · base64_encode

<?

$data = 'encoded string';
$body = base64_encode($data);

$return = chunk_split($body);
echo $return;
ZW5jb2RlZCBzdHJpbmc=