php-doc-en/reference/strings/functions/chunk-split.xml
2009-11-25 14:49:47 +00:00

115 lines
3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.chunk-split">
<refnamediv>
<refname>chunk_split</refname>
<refpurpose>Split a string into smaller chunks</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>chunk_split</methodname>
<methodparam><type>string</type><parameter>body</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>chunklen</parameter><initializer>76</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>end</parameter><initializer>"\r\n"</initializer></methodparam>
</methodsynopsis>
<para>
Can be used to split a string into smaller chunks which is useful for
e.g. converting <function>base64_encode</function> output to match RFC
2045 semantics. It inserts <parameter>end</parameter> every
<parameter>chunklen</parameter> characters.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>body</parameter></term>
<listitem>
<para>
The string to be chunked.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>chunklen</parameter></term>
<listitem>
<para>
The chunk length.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>end</parameter></term>
<listitem>
<para>
The line ending sequence.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the chunked string.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>chunk_split</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
// format $data using RFC 2045 semantics
$new_string = chunk_split(base64_encode($data));
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>str_split</function></member>
<member><function>explode</function></member>
<member><function>split</function></member>
<member><function>wordwrap</function></member>
<member><link xlink:href="&url.rfc;2045">RFC 2045</link></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->