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=
Links
String
- addcslashes
- addslashes
- bin2hex
- chop
- chr
- convert_uudecode
- convert_uuencode
- count_chars
- crc32
- crypt
- echo
- explode
- fprintf
- get_html_translation_table
- hebrev
- hebrevc
- hex2bin
- html_entity_decode
- htmlentities
- htmlspecialchars
- htmlspecialchars_decode
- implode
- join
- lcfirst
- levenshtein
- localeconv
- ltrim
- md5
- md5_file
- metaphone
- nl_langinfo
- nl2br
- number_format
- ord
- parse_str
- printf
- quoted_printable_decode
- quoted_printable_encode
- quotemeta
- rtrim
- setlocale
- sha1
- sha1_file
- similar_text
- soundex
- sprintf
- sscanf
- str_contains
- str_decrement
- str_ends_with
- str_getcsv
- str_increment
- str_ireplace
- str_pad
- str_repeat
- str_replace
- str_rot13
- str_shuffle
- str_split
- str_starts_with
- str_word_count
- strcasecmp
- strchr
- strcmp
- strcoll
- strcspn
- strip_tags
- stripcslashes
- stripos
- stripslashes
- stristr
- strlen
- strnatcasecmp
- strnatcmp
- strncasecmp
- strncmp
- strpbrk
- strpos
- strrchr
- strrev
- strripos
- strrpos
- strspn
- strstr
- strtok
- strtolower
- strtoupper
- strtr
- substr
- substr_compare
- substr_count
- substr_replace
- trim
- ucfirst
- ucwords
- vfprintf
- vprintf
- vsprintf
- wordwrap