★ wanayoo — archive 1999 http://fr.php.net/manual/en/function.chunk-split.phpNouvelle recherche | Portail wanayoo
PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previouschrconvert_cyr_stringnext
Last updated: Thu, 15 Aug 2002
view the printer friendly version or the printer friendly version with notes or change language to Brazilian Portuguese | Chinese | Czech | Dutch | Finnish | French | German | Hungarian | Italian | Japanese | Korean | Polish | Romanian | Russian | Spanish | Turkish

chunk_split

(PHP 3>= 3.0.6, PHP 4 )

chunk_split -- Split a string into smaller chunks

Description

string chunk_split ( string body [, int chunklen [, string end]])

Can be used to split a string into smaller chunks which is useful for e.g. converting base64_encode output to match RFC 2045 semantics. It inserts end (defaults to "\r\n") every chunklen characters (defaults to 76). It returns the new string leaving the original string untouched.

Example 1. chunk_split() example

# format $data using RFC 2045 semantics

$new_string = chunk_split(base64_encode($data));

See also explode(), split() wordwrap() and RFC 2045.

User Contributed Notes
chunk_split
add a note about notes
sbarnum@pointsystems.com
21-Apr-2001 01:46

chunk_split will also add the break _after_ the last occurence. So, attempting to split a color into base components,
chunk_split('FF99FF', 2, ':');
will return FF:99:FF:

add a note about notes
previouschrconvert_cyr_stringnext
Last updated: Thu, 15 Aug 2002
show source | credits | stats | mirror sites
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: nexen.net
Last updated: Sun Aug 18 04:45:58 2002 CEST